3
0
Fork 0

FIXED: kiwix-serve crash if unattended search "start" & "end" values

small_fixes
kelson42 11 years ago
parent c5c8636c9f
commit 5799cbdaa9

@ -306,14 +306,8 @@ static int accessHandlerCallback(void *cls,
if (patternCorrespondingUrl.empty() && searcher != NULL) { if (patternCorrespondingUrl.empty() && searcher != NULL) {
const char* start = MHD_lookup_connection_value(connection, MHD_GET_ARGUMENT_KIND, "start"); const char* start = MHD_lookup_connection_value(connection, MHD_GET_ARGUMENT_KIND, "start");
const char* end = MHD_lookup_connection_value(connection, MHD_GET_ARGUMENT_KIND, "end"); const char* end = MHD_lookup_connection_value(connection, MHD_GET_ARGUMENT_KIND, "end");
unsigned int startNumber = 0; unsigned int startNumber = (start != NULL ? atoi(start) : 0);
unsigned int endNumber = 25; unsigned int endNumber = (end != NULL ? atoi(end) : 25);
if (start != NULL)
startNumber = atoi(start);
if (end != NULL)
endNumber = atoi(end);
/* Get the results */ /* Get the results */
pthread_mutex_lock(&searcherLock); pthread_mutex_lock(&searcherLock);

@ -27,6 +27,7 @@
#kiwixsearchbox { #kiwixsearchbox {
margin: 0px; margin: 0px;
float: right; float: right;
width: 300px;
} }
#kiwixsearch { #kiwixsearch {

Loading…
Cancel
Save