Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion main/rfc1867.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ static void normalize_protected_variable(char *varname) /* {{{ */

/* and remove it */
if (s != varname) {
memmove(varname, s, strlen(s)+1);
size_t slen = strlen(s) + 1;
memmove(varname, s, slen);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the same thing to the original code, seems like this does not add a bounds check as you've described...?

}

for (p = varname; *p && *p != '['; p++) {
Expand Down Expand Up @@ -596,6 +597,9 @@ static size_t multipart_buffer_read(multipart_buffer *self, char *buf, size_t by
}

/* maximum number of bytes we are reading */
if (bytes == 0) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, the new bytes == 0 early return does not address the claimed remote memcpy()
overflow. The copy length is already constrained by len <= bytes - 1 (see line 603), and all in-tree callers pass a positive fixed buffer size (sizeof(buf) / sizeof(buff)) AFAIK. Or maybe I am missing something here

return 0;
}
len = max < bytes-1 ? max : bytes-1;

/* if we read any data... */
Expand Down
Loading