Applied patch from Emiliano to fix possible buffer overflow

SVN revision: 1335
This commit is contained in:
Stefan Ritt 2005-04-27 10:43:43 +00:00
parent a1f74e7fa6
commit 79f213946c

View File

@ -6,6 +6,9 @@
Contents: Web server program for Electronic Logbook ELOG Contents: Web server program for Electronic Logbook ELOG
$Log$ $Log$
Revision 1.638 2005/04/27 10:43:43 ritt
Applied patch from Emiliano to fix possible buffer overflow
Revision 1.637 2005/04/22 13:42:51 ritt Revision 1.637 2005/04/22 13:42:51 ritt
Version 2.5.8-6 Version 2.5.8-6
@ -5564,7 +5567,7 @@ void write_logfile(LOGBOOK * lbs, const char *format, ...)
char str[10000]; char str[10000];
FILE *f; FILE *f;
time_t now; time_t now;
char buf[1000]; char buf[10000];
if (lbs == NULL) { if (lbs == NULL) {
if (!getcfg("global", "logfile", str, sizeof(str))) if (!getcfg("global", "logfile", str, sizeof(str)))
@ -5573,7 +5576,7 @@ void write_logfile(LOGBOOK * lbs, const char *format, ...)
return; return;
if (str[0] == DIR_SEPARATOR || str[1] == ':') if (str[0] == DIR_SEPARATOR || str[1] == ':')
strcpy(file_name, str); strlcpy(file_name, str, sizeof(file_name));
else { else {
strlcpy(file_name, resource_dir, sizeof(file_name)); strlcpy(file_name, resource_dir, sizeof(file_name));
strlcat(file_name, str, sizeof(file_name)); strlcat(file_name, str, sizeof(file_name));