fix: improvements allocation safety and string processing
This commit is contained in:
@@ -214,13 +214,17 @@ int setup_job(ScrapeJob *job, CURLM *multi_handle) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (char *p = encoded_query + strlen(encoded_query) - 3; p >= encoded_query;
|
||||
p--) {
|
||||
if (p[0] == '%' && p[1] == '2' && p[2] == '0') {
|
||||
*p = '+';
|
||||
memmove(p + 1, p + 3, strlen(p + 3) + 1);
|
||||
char *read = encoded_query;
|
||||
char *write = encoded_query;
|
||||
while (*read) {
|
||||
if (read[0] == '%' && read[1] == '2' && read[2] == '0') {
|
||||
*write++ = '+';
|
||||
read += 3;
|
||||
} else {
|
||||
*write++ = *read++;
|
||||
}
|
||||
}
|
||||
*write = '\0';
|
||||
|
||||
char *full_url =
|
||||
build_search_url(job->engine->base_url, job->engine->page_param,
|
||||
|
||||
Reference in New Issue
Block a user