Testing: check if hostname is longer than zero

This commit is contained in:
Zdenek Dohnal 2020-12-15 12:05:54 +01:00
parent a18f2a8c06
commit a8bd0e8343
2 changed files with 25 additions and 1 deletions

23
airscan-nohostname.patch Normal file
View File

@ -0,0 +1,23 @@
diff --git a/airscan-http.c b/airscan-http.c
index 1fdef6e..a32c50f 100644
--- a/airscan-http.c
+++ b/airscan-http.c
@@ -972,7 +972,7 @@ http_uri_strip_zone_suffux (http_uri *uri)
{
http_uri_field field;
const char *suffix;
- size_t len;
+ size_t len = 0;
char *host;
/* Check if we need to change something */
@@ -987,6 +987,9 @@ http_uri_strip_zone_suffux (http_uri *uri)
}
len = suffix - field.str;
+ if (len == 0) {
+ return; /* No hostname */
+ }
/* Update host */
host = alloca(len + 1);

View File

@ -5,7 +5,7 @@
Name: sane-airscan
Version: 0.99.21
Release: 1%{?dist}
Release: 1%{?dist}.testing
Summary: SANE backend for AirScan (eSCL) and WSD document scanners
# the exception is defined in LICENSE, meant for SANE project in most cases
License: GPLv2+ with exceptions
@ -13,6 +13,7 @@ URL: https://github.com/alexpevzner/sane-airscan
Source: %{URL}/archive/%{version}/%{name}-%{version}.tar.gz
# backported from upstream
Patch001: airscan-nohostname.patch
# needed for querying and getting mDNS messages from local network