Skip to content

Commit

Permalink
Critical bug: realloc size uncorrect.
Browse files Browse the repository at this point in the history
  • Loading branch information
julienblitte committed Jul 29, 2017
1 parent 6db8d63 commit 4942cf0
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,13 @@ const char *http_search_variable(text t, const char *variable)
char *pattern;
size_t len;

fprintf(stderr, "<debug> http_search_variable(\"%p\",\"%s\")\n", t, variable);

len = strlen(variable)+1;
pattern = (char *)malloc(len+1); // pattern must be freed (1)

snprintf(pattern, len+1, "%s:", variable);
fprintf(stderr, "<debug> pattern: \"%s\"\n", pattern);

for(l=0; t[l]; l++)
{
fprintf(stderr, "<debug> l=%d\n", l);
fprintf(stderr, "<debug> t[l]=%p\n", t[l]);
fprintf(stderr, "<debug> strncasecmp(\"%s\",\"%s\")\n", t[l], pattern);
if (!strncasecmp(t[l], pattern, len))
{
free(pattern); // pattern freed here (1) 1/2
Expand Down

0 comments on commit 4942cf0

Please sign in to comment.