Skip to content

Commit

Permalink
Fix off-by-one error in allocating space for copy of a string.
Browse files Browse the repository at this point in the history
  • Loading branch information
manugarg committed Sep 1, 2015
1 parent a55c90b commit 23df5d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pac_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ static const char *pacUtils =

// You must free the result if result is non-NULL.
char *str_replace(const char *orig, char *rep, char *with) {
char *tmporig = (char*) malloc(strlen(orig)); // Copy of orig that we work with
char *tmporig = malloc(strlen(orig) + 1); // Copy of orig that we work with
tmporig = strcpy(tmporig, orig);

char *result; // the return string
Expand Down

0 comments on commit 23df5d3

Please sign in to comment.