Fix error parsing Location job.

fix-build-obselete-jpeg
thierry1970 2020-03-06 10:58:31 +01:00
rodzic 5da64adadf
commit 2739969661
1 zmienionych plików z 16 dodań i 10 usunięć

Wyświetl plik

@ -206,17 +206,23 @@ escl_newjob (capabilities_t *scanner, SANE_String_Const name, SANE_Status *statu
}
else {
if (download->memory != NULL) {
if (strstr(download->memory, "Location:")) {
temporary = strrchr(download->memory, '/');
char *tmp_location = strstr(download->memory, "Location:");
if (tmp_location) {
temporary = strchr(tmp_location, '\r');
if (temporary == NULL)
temporary = strchr(tmp_location, '\n');
if (temporary != NULL) {
location = strchr(temporary, '\r');
if (location == NULL)
location = strchr(temporary, '\n');
else {
*location = '\0';
result = strdup(temporary);
}
DBG( 1, "Create NewJob : %s\n", result);
*temporary = '\0';
location = strrchr(tmp_location,'/');
if (location) {
result = strdup(location);
DBG( 1, "Create NewJob : %s\n", result);
*temporary = '\n';
}
}
if (result == NULL) {
DBG( 1, "Error : Create NewJob, no location\n");
*status = SANE_STATUS_INVAL;
}
free(download->memory);
}