From a8bd0e83435d675d76cb4b4186a8e4cc81fb1bac Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Tue, 15 Dec 2020 12:05:54 +0100 Subject: [PATCH] Testing: check if hostname is longer than zero --- airscan-nohostname.patch | 23 +++++++++++++++++++++++ sane-airscan.spec | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 airscan-nohostname.patch diff --git a/airscan-nohostname.patch b/airscan-nohostname.patch new file mode 100644 index 0000000..0eab94c --- /dev/null +++ b/airscan-nohostname.patch @@ -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); diff --git a/sane-airscan.spec b/sane-airscan.spec index c13200b..f4d99e2 100644 --- a/sane-airscan.spec +++ b/sane-airscan.spec @@ -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