Fixed bug with truncated entries

SVN revision: 1993
This commit is contained in:
2008-01-10 15:26:20 +00:00
parent e83da10d5d
commit 3f54a1fb06
+32 -12
View File
@@ -25517,19 +25517,39 @@ void decode_post(char *logbook, LOGBOOK * lbs, const char *string, const char *b
else if (strstr(p, "\r\r\n\r\r\n"))
p = strstr(p, "\r\r\n\r\r\n") + 6;
if (strstr(p, boundary)) {
strlcpy(str, p, sizeof(str));
if (strstr(str, boundary))
*strstr(str, boundary) = 0;
string = strstr(p, boundary) + strlen(boundary);
ptmp = str + (strlen(str) - 1);
while (*ptmp == '-')
*ptmp-- = 0;
while (*ptmp == '\n' || *ptmp == '\r')
*ptmp-- = 0;
}
if (setparam(item, str) == 0)
return;
string = strstr(p, boundary) + strlen(boundary);
if (stricmp(item, "text") == 0) {
if ((int)string - (int)p > TEXT_SIZE) {
sprintf(str,
"Error: Entry text too big (%lu bytes). Please increase TEXT_SIZE and recompile elogd\n",
(unsigned long) ((int)string - (int)p));
show_error(str);
return;
}
strlcpy(_mtext, p, sizeof(_mtext));
if (strstr(_mtext, boundary))
*strstr(_mtext, boundary) = 0;
ptmp = _mtext + (strlen(_mtext) - 1);
while (*ptmp == '-')
*ptmp-- = 0;
while (*ptmp == '\n' || *ptmp == '\r')
*ptmp-- = 0;
} else {
strlcpy(str, p, sizeof(str));
if (strstr(str, boundary))
*strstr(str, boundary) = 0;
ptmp = str + (strlen(str) - 1);
while (*ptmp == '-')
*ptmp-- = 0;
while (*ptmp == '\n' || *ptmp == '\r')
*ptmp-- = 0;
if (setparam(item, str) == 0)
return;
}
}
}
while (*string == '-' || *string == '\n' || *string == '\r')