diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2011-03-22 11:46:19 +0000 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2011-03-22 11:46:19 +0000 |
commit | feb0a4aeaa016f892b5038ec8dca84fe125149bd (patch) | |
tree | d6e85b4cb0c5bd3899852ca81c749efce7442ff2 /tools | |
parent | bdf603c40330d7f7f3251c7caebe4f39d01a6344 (diff) |
Allocate space for null termination in make_basename.
Coverity 710.
svn path=/trunk/; revision=36247
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lemon/lemon.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/lemon/lemon.c b/tools/lemon/lemon.c index 4ea4515e7c..25ec059368 100644 --- a/tools/lemon/lemon.c +++ b/tools/lemon/lemon.c @@ -1397,13 +1397,13 @@ make_basename(char* fullname) #endif if (!cp) { - new_string = malloc( strlen(fullname) ); + new_string = malloc( strlen(fullname) + 1 ); strcpy(new_string, fullname); } else { /* skip the slash */ cp++; - new_string = malloc( strlen(cp) ); + new_string = malloc( strlen(cp) + 1 ); strcpy(new_string, cp); } |