Skip to content

Commit 445ed7c

Browse files
gasbytesdanielinux
authored andcommitted
memchr instead of strchr to respect length of the url
1 parent 0d4e4cb commit 445ed7c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/http/httpd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ int http_url_encode(char *buf, size_t len, size_t max_len) {
265265
char *p = buf;
266266
char *q = NULL;
267267
while (p < buf + len) {
268-
q = strchr(p, ' ');
268+
q = memchr(p, ' ', len - (size_t)(p - buf));
269269
if (!q) {
270270
break;
271271
}

0 commit comments

Comments
 (0)