2019-03-15 Fred Gleason <fredg@paravelsystems.com>

* Fixed a bug in the rivwebcapi 'RD_ListLogs()' that caused
	corruption of log names containing multi-byte UTF-8 characters.
	* Fixed a bug in the rivwebcapi 'RD_ListLog()' that caused
	corruption of log names containing multi-byte UTF-8 characters.
	* Fixed a regression in the 'RDLogEvent::insert()' method
	that threw a segfault when applied on am empty log.
	* Fixed a bug in date/time parsing methods that could cause
	segfaults.
This commit is contained in:
Fred Gleason
2019-03-15 15:55:10 -04:00
parent 25d0f414c4
commit 2df7752270
5 changed files with 48 additions and 41 deletions

View File

@@ -426,8 +426,6 @@ int RD_ListLog(struct rd_logline *logline[],
CURL *curl=NULL;
XML_Parser parser;
struct xml_data xml_data;
char real_logname[64];
char *real_index = &real_logname[0];
long response_code;
int i;
char errbuf[CURL_ERROR_SIZE];
@@ -443,18 +441,6 @@ int RD_ListLog(struct rd_logline *logline[],
if (strlen(logname)==0) {
return 400; /* Log Name Missing */
}
/* make the actual log name */
if (strlen(logname)>60) {
return 404; /* Log Name Incorrect */
}
memset(real_logname,'\0',sizeof(real_logname));
for (i = 0; i<strlen(logname);i++) {
if (logname[i]>32) {
strncpy(real_index,&logname[i],1);
real_index++;
}
}
if((curl=curl_easy_init())==NULL) {
curl_easy_cleanup(curl);
return -1;
@@ -508,7 +494,7 @@ int RD_ListLog(struct rd_logline *logline[],
CURLFORM_PTRNAME,
"NAME",
CURLFORM_COPYCONTENTS,
real_logname,
logname,
CURLFORM_END);
curl_easy_setopt(curl,CURLOPT_WRITEDATA,parser);
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,__ListLogCallback);

View File

@@ -155,8 +155,6 @@ int RD_ListLogs(struct rd_log *logs[],
XML_Parser parser;
char checked_service[11]={0};
char *check_svc = &checked_service[0];
char checked_logname[65]={0};
char *check_logname = &checked_logname[0];
int checked_trackable = 0;
int checked_recent = 0;
struct xml_data xml_data;
@@ -188,16 +186,6 @@ int RD_ListLogs(struct rd_log *logs[],
}
}
}
if ((strlen(logname) > 0) &&
(strlen(logname) < 65)) {
for (i = 0; i<strlen(logname);i++) {
if (logname[i]>32) {
strncpy(check_logname,&logname[i],1);
check_logname++;
}
}
}
if((curl=curl_easy_init())==NULL) {
curl_easy_cleanup(curl);
return -1;
@@ -259,7 +247,7 @@ int RD_ListLogs(struct rd_log *logs[],
CURLFORM_PTRNAME,
"LOG_NAME",
CURLFORM_COPYCONTENTS,
checked_logname,
logname,
CURLFORM_END);
snprintf(cart_buffer,7,"%d",checked_trackable);