You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
diff --git a/backend/ieee1284.c b/backend/ieee1284.c
index d3fd303..19555ba 100644
--- a/backend/ieee1284.c
+++ b/backend/ieee1284.c
@@ -196,12 +196,19 @@ backendGetDeviceID(
* and then limit the length to the size of our buffer...
*/
\* 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 --git a/backend/usb-libusb.c b/backend/usb-libusb.c
index 3cb61e3..d5c6ae5 100644
--- a/backend/usb-libusb.c
+++ b/backend/usb-libusb.c
@@ -418,12 +418,14 @@ get_device_id(usb_printer_t printer, / I - Printer */
and then limit the length to the size of our buffer...
*/
Activity
michaelrsweet commentedon Aug 7, 2009
CUPS.org User: mike
Fixed in Subversion repository.
michaelrsweet commentedon Aug 7, 2009
"0001-Truncate-Device-ID-string-at-the-correct-point.patch":
From 6bba4e202372910ed4868107a935737176d663d6 Mon Sep 17 00:00:00 2001
From: Tim Waugh twaugh@redhat.com
Date: Sat, 18 Jul 2009 16:11:57 +0100
Subject: [PATCH] Truncate Device ID string at the correct point.
The IEEE 1284 Device ID specification says that the initial MSB length
field includes the 2 bytes of that field itself.
backend/ieee1284.c | 13 ++++++++++---
backend/usb-libusb.c | 8 +++++---
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/backend/ieee1284.c b/backend/ieee1284.c
index d3fd303..19555ba 100644
--- a/backend/ieee1284.c
+++ b/backend/ieee1284.c
@@ -196,12 +196,19 @@ backendGetDeviceID(
* and then limit the length to the size of our buffer...
*/
length = (((unsigned)device_id[1] & 255) << 8) +
((unsigned)device_id[0] & 255);
length = device_id_size - 2;
length = device_id_size;
/*
diff --git a/backend/usb-libusb.c b/backend/usb-libusb.c
index 3cb61e3..d5c6ae5 100644
--- a/backend/usb-libusb.c
+++ b/backend/usb-libusb.c
@@ -418,12 +418,14 @@ get_device_id(usb_printer_t printer, / I - Printer */
*/
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;
/*
* Copy the device ID text to the beginning of the buffer and
1.6.2.5