mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Fixed crash with incomplete attachments
SVN revision: 2174
This commit is contained in:
parent
1c3a67ca38
commit
0773a09002
16
src/elogd.c
16
src/elogd.c
@ -26415,8 +26415,10 @@ void decode_post(char *logbook, LOGBOOK * lbs, const char *string, const char *b
|
|||||||
/* find next boundary */
|
/* find next boundary */
|
||||||
pctmp = string;
|
pctmp = string;
|
||||||
do {
|
do {
|
||||||
while (*pctmp != '-')
|
while (*pctmp != '-' && pctmp < string + length)
|
||||||
pctmp++;
|
pctmp++;
|
||||||
|
if (pctmp == string + length)
|
||||||
|
return;
|
||||||
if ((p = strstr(pctmp, boundary)) != NULL) {
|
if ((p = strstr(pctmp, boundary)) != NULL) {
|
||||||
if (*(p - 1) == '-')
|
if (*(p - 1) == '-')
|
||||||
p--;
|
p--;
|
||||||
@ -26481,8 +26483,10 @@ void decode_post(char *logbook, LOGBOOK * lbs, const char *string, const char *b
|
|||||||
/* find next boundary */
|
/* find next boundary */
|
||||||
pctmp = string;
|
pctmp = string;
|
||||||
do {
|
do {
|
||||||
while (*pctmp != '-')
|
while (*pctmp != '-' && pctmp < string + length)
|
||||||
pctmp++;
|
pctmp++;
|
||||||
|
if (pctmp == string + length)
|
||||||
|
return;
|
||||||
if ((p = strstr(pctmp, boundary)) != NULL) {
|
if ((p = strstr(pctmp, boundary)) != NULL) {
|
||||||
if (*(p - 1) == '-')
|
if (*(p - 1) == '-')
|
||||||
p--;
|
p--;
|
||||||
@ -28014,6 +28018,14 @@ void server_loop(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strncmp(net_buffer, "POST", 4) == 0 &&
|
||||||
|
len < header_length + content_length) {
|
||||||
|
if (verbose)
|
||||||
|
eprintf("Incomplete POST request\n");
|
||||||
|
keep_alive = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* now process HTTP request and put the result into the return_buffer */
|
/* now process HTTP request and put the result into the return_buffer */
|
||||||
if (process_http_request(net_buffer, i_conn)) {
|
if (process_http_request(net_buffer, i_conn)) {
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user