From: liuli Date: Fri, 3 Sep 2021 02:23:18 +0000 (+0800) Subject: fix _cupsGet1284Values X-Git-Tag: v2.4b1~41^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9181b66c253df3ef00fbc99763a5242a9fdf86bc;p=thirdparty%2Fcups.git fix _cupsGet1284Values when 1284id doesn't end with semicolon,_cupsGet1284Values() cannot get last key and value. eg. uos@uos-PC:/usr/lib/cups/backend/snmp 10.10.120.220 network socket://10.10.120.220 "Unknown" "FUJI XEROX ApeosPort-V 4070 v 3. 43. 0 Multifunction System" "MANUFACTURER:FUJI XEROX;MODEL:ApeosPort-V 4070" "" --- diff --git a/cups/options.c b/cups/options.c index 11814c9af2..b95785b84d 100644 --- a/cups/options.c +++ b/cups/options.c @@ -598,12 +598,13 @@ _cupsGet1284Values( if (!*device_id) break; - + + memset(value, 0, sizeof(value)); for (ptr = value; *device_id && *device_id != ';'; device_id ++) if (ptr < (value + sizeof(value) - 1)) *ptr++ = *device_id; - if (!*device_id) + if (!*device_id && strlen(value) == 0) break; while (ptr > value && _cups_isspace(ptr[-1]))