[project @ 2005-06-27 01:57:54 by adrianl]

Fix termination of output from url_escape

svn path=/import/netsurf/; revision=1770
This commit is contained in:
Adrian Lees 2005-06-27 01:57:54 +00:00
parent ba6f228418
commit 8aed1103b6

View File

@ -633,13 +633,15 @@ url_func_result url_escape(const char *unescaped, char **result)
}
}
(*result) = malloc(++d - escaped + 1);
*d++ = '\0';
(*result) = malloc(d - escaped);
if (!(*result)) {
free(escaped);
return URL_FUNC_NOMEM;
}
snprintf((*result), d - escaped, "%s", escaped);
(*result)[d - escaped] = '\0';
memcpy((*result), escaped, d - escaped);
free(escaped);