diff options
author | Alan Coopersmith <alan.coopersmith@sun.com> | 2007-05-14 19:04:24 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2007-05-14 19:04:24 -0700 |
commit | f749d926bd9796badee2efd1ee1da5905d6fd38d (patch) | |
tree | 4e3e38febb7dab907003f0d588c28b43ae657e00 | |
parent | 1a142e8b29113bbd9daf21b8371f1572cd0152dd (diff) | |
download | iceauth-f749d926bd9796badee2efd1ee1da5905d6fd38d.tar.gz |
Replace copystring() with strdup() calls
Also solves Coverity #924: Function copystring:
Pointer "src" dereferenced before NULL check
-rw-r--r-- | process.c | 14 |
1 files changed, 1 insertions, 13 deletions
@@ -83,7 +83,6 @@ static char *stdout_filename = "(stdout)"; /* for messages */ static char *Yes = "yes"; /* for messages */ static char *No = "no"; /* for messages */ -static char *copystring ( char *src ); static int binaryEqual ( char *a, char *b, unsigned len ); static void prefix ( char *fn, int n ); static void badcommandline ( char *cmd ); @@ -230,18 +229,7 @@ static int original_umask = 0; /* for restoring */ * private utility procedures */ -static char *copystring (src) - char *src; -{ - int len = strlen (src); - char *cp; - - if (!src) return NULL; - cp = malloc (len + 1); - if (cp) - strcpy (cp, src); - return cp; -} +#define copystring(s) ( s != NULL ? strdup(s) : NULL ) static int binaryEqual (a, b, len) |