mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Fixed bug with truncated entries
SVN revision: 1993
This commit is contained in:
parent
e83da10d5d
commit
3f54a1fb06
44
src/elogd.c
44
src/elogd.c
@ -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"))
|
else if (strstr(p, "\r\r\n\r\r\n"))
|
||||||
p = strstr(p, "\r\r\n\r\r\n") + 6;
|
p = strstr(p, "\r\r\n\r\r\n") + 6;
|
||||||
if (strstr(p, boundary)) {
|
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)
|
string = strstr(p, boundary) + strlen(boundary);
|
||||||
return;
|
|
||||||
|
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')
|
while (*string == '-' || *string == '\n' || *string == '\r')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user