diff options
author | Christian Pointner <equinox@spreadspace.org> | 2010-12-12 21:16:31 +0000 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2010-12-12 21:16:31 +0000 |
commit | b15a83ceb1f20cae0587f93e8279ac376552fa8f (patch) | |
tree | ddebf833b294a30ab05302676f3ba129ae22b333 | |
parent | updated ChangeLog (release 0.2) (diff) |
fixed problematic usage of strndup
git-svn-id: https://svn.spreadspace.org/tcpproxy/trunk@58 e61f0598-a718-4e21-a8f0-0aadfa62ad6b
-rw-r--r-- | src/cfg_parser.rl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cfg_parser.rl b/src/cfg_parser.rl index 07027f7..39836ab 100644 --- a/src/cfg_parser.rl +++ b/src/cfg_parser.rl @@ -86,10 +86,14 @@ static int owrt_string(char** dest, char* start, char* end) return -1; if(*dest) free(*dest); - *dest = strndup(start, end - start); + int n = end - start; + *dest = malloc(n+1); if(!(*dest)) return -2; + memcpy(*dest, start, n); + (*dest)[n] = 0; + return 0; } |