Skip to content

Commit

Permalink
fix an off-by-one error.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsahara committed Dec 11, 2012
1 parent 57482ef commit 913d68b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mrbgems/generator.c
Expand Up @@ -60,8 +60,9 @@ static char
* String which will be the replacement
*
*/
static char
*replace(const char *s, const char *old, const char *new)

static char *
replace(const char *s, const char *old, const char *new)
{
char *ret;
int i, count = 0;
Expand All @@ -75,7 +76,7 @@ static char
}
}

ret = malloc(i + count * (newlen - oldlen));
ret = malloc(i + count * (newlen - oldlen) + 1);
if (ret == NULL)
exit(EXIT_FAILURE);

Expand Down

0 comments on commit 913d68b

Please sign in to comment.