diff --git a/cups-str3266.patch b/cups-str3266.patch new file mode 100644 index 0000000..9dddf2c --- /dev/null +++ b/cups-str3266.patch @@ -0,0 +1,47 @@ +diff -up cups-1.4rc1/backend/ieee1284.c.device-id cups-1.4rc1/backend/ieee1284.c +--- cups-1.4rc1/backend/ieee1284.c.device-id 2009-07-18 18:25:38.355769382 +0100 ++++ cups-1.4rc1/backend/ieee1284.c 2009-07-18 18:25:43.844894365 +0100 +@@ -196,12 +196,19 @@ backendGetDeviceID( + * and then limit the length to the size of our buffer... + */ + +- if (length > (device_id_size - 2)) ++ if (length > device_id_size) + length = (((unsigned)device_id[1] & 255) << 8) + + ((unsigned)device_id[0] & 255); + +- if (length > (device_id_size - 2)) +- length = device_id_size - 2; ++ if (length > device_id_size) ++ length = device_id_size; ++ ++ /* ++ * The length field counts the number of bytes in the string ++ * including the length field itself (2 bytes). ++ */ ++ ++ length -= 2; + + /* + * Copy the device ID text to the beginning of the buffer and +diff -up cups-1.4rc1/backend/usb-libusb.c.device-id cups-1.4rc1/backend/usb-libusb.c +--- cups-1.4rc1/backend/usb-libusb.c.device-id 2009-01-14 19:46:43.000000000 +0000 ++++ cups-1.4rc1/backend/usb-libusb.c 2009-07-18 18:25:43.845895048 +0100 +@@ -418,12 +418,14 @@ get_device_id(usb_printer_t *printer, /* + * and then limit the length to the size of our buffer... + */ + +- if (length > (bufsize - 2)) ++ if (length > bufsize) + length = (((unsigned)buffer[1] & 255) << 8) + + ((unsigned)buffer[0] & 255); + +- if (length > (bufsize - 2)) +- length = bufsize - 2; ++ if (length > bufsize) ++ length = bufsize; ++ ++ length -= 2; + + /* + * Copy the device ID text to the beginning of the buffer and diff --git a/cups.spec b/cups.spec index 24f5d3a..04ee248 100644 --- a/cups.spec +++ b/cups.spec @@ -10,7 +10,7 @@ Summary: Common Unix Printing System Name: cups Version: 1.4 -Release: 0.%{pre}.11%{?dist}.1 +Release: 0.%{pre}.12%{?dist} License: GPLv2 Group: System Environment/Daemons Source: ftp://ftp.easysw.com/pub/cups/test//cups-%{version}%{?pre}%{?svn}-source.tar.bz2 @@ -56,7 +56,8 @@ Patch29: cups-str3259.patch Patch30: cups-uri-compat.patch Patch31: cups-str3254.patch Patch32: cups-str3253.patch -Patch33: cups-avahi.patch +Patch33: cups-str3266.patch +Patch34: cups-avahi.patch Patch100: cups-lspp.patch Epoch: 1 Url: http://www.cups.org/ @@ -210,7 +211,8 @@ module. %patch30 -p1 -b .uri-compat %patch31 -p1 -b .str3254 %patch32 -p1 -b .str3253 -#%patch33 -p1 -b .avahi +%patch33 -p1 -b .str3266 +#%patch34 -p1 -b .avahi %if %lspp %patch100 -p1 -b .lspp @@ -503,6 +505,9 @@ rm -rf $RPM_BUILD_ROOT %{php_extdir}/phpcups.so %changelog +* Tue Jul 28 2009 Tim Waugh 1:1.4-0.rc1.12 +- Fixed Device ID reporting in the usb backend (STR #3266). + * Fri Jul 24 2009 Fedora Release Engineering - 1:1.4-0.rc1.11.1 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild