[Pkg-privacy-commits] [onioncat] 229/241: fixed double free() segfault in case of multiple option -f

Intrigeri intrigeri at moszumanska.debian.org
Wed Aug 26 16:17:16 UTC 2015


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to branch upstream-master
in repository onioncat.

commit ae05af75fa062652f74011766ac011acc580f6c9
Author: eagle <eagle at 58e1ccc2-750e-0410-8d0d-f93ca75ab447>
Date:   Thu Jul 4 11:31:13 2013 +0000

    fixed double free() segfault in case of multiple option -f
    
    git-svn-id: https://www.cypherpunk.at/svn/onioncat/trunk@558 58e1ccc2-750e-0410-8d0d-f93ca75ab447
---
 src/ocat.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/ocat.c b/src/ocat.c
index d925af7..4fc6b9d 100644
--- a/src/ocat.c
+++ b/src/ocat.c
@@ -291,7 +291,7 @@ void cleanup_system(void)
 
 void parse_opt_early(int argc, char *argv_orig[])
 {
-   int c;
+   int c, optf = 0;
    char *argv[argc + 1];
 
    log_debug("parse_opt_early()");
@@ -305,8 +305,14 @@ void parse_opt_early(int argc, char *argv_orig[])
       switch (c)
       {
          case 'f':
-            free(CNF(config_file));
-            CNF(config_file) = optarg;
+            if (!optf)
+            {
+               free(CNF(config_file));
+               CNF(config_file) = optarg;
+               optf++;
+            }
+            else
+               log_msg(LOG_ERR, "multiple options -f ignored");
             break;
 
          case 'I':

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onioncat.git



More information about the Pkg-privacy-commits mailing list