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

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:04:51 UTC 2015


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

infinity0 pushed a commit to branch debian
in repository onioncat.

commit e85c230f4b66d21ac8dac5fc11532aa8624cef70
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