1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-08-31 15:11:08 +00:00

Fix detection of upload boundary.

Sometime a boundary can be splitted and received in two read operations.
This commit is contained in:
Jonathan Xu
2021-02-10 10:45:34 +08:00
committed by 杨赫然
parent 814b796038
commit 02d3ca7edc

View File

@@ -1982,7 +1982,7 @@ recv_form_field (RecvFSM *fsm, gboolean *no_line)
free (line);
} else {
size_t size = evbuffer_get_length (fsm->line);
if (size > 0) {
if (size >= strlen(fsm->boundary)) {
char *buf = g_new (char, size);
evbuffer_remove (fsm->line, buf, size);
if (strstr(buf, fsm->boundary) != NULL) {
@@ -2043,7 +2043,7 @@ recv_file_data (RecvFSM *fsm, gboolean *no_line)
if (!line) {
// handle boundary
size_t size = evbuffer_get_length (fsm->line);
if (size > 0) {
if (size >= strlen(fsm->boundary)) {
char *buf = g_new (char, size);
evbuffer_remove (fsm->line, buf, size);
if (strstr(buf, fsm->boundary) != NULL) {