File 0007-sg_inq-Do-not-export-long-identifiers.patch of Package sg3_utils.1394

From 6044f09bd55a9e215b662f8822c41b16fba523d2 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 3 Sep 2014 15:52:15 +0200
Subject: [PATCH 2/2] sg_inq: Do not export long identifiers

Some targets (accidentally) display really long vendor specific
IDs. These will cause a pathname overflow when udev tries to
generate links based on that name.
So skip any vendor-specific IDs which are longer than 128 characters;
vendor-specific IDs are of limited usage anyway.

References: bnc#884779

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 src/sg_inq.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/sg_inq.c b/src/sg_inq.c
index a78960f..74b11ff 100644
--- a/src/sg_inq.c
+++ b/src/sg_inq.c
@@ -1827,6 +1827,8 @@ export_dev_ids(unsigned char * buff, int len, int verbose)
         }
         switch (desig_type) {
         case 0: /* vendor specific */
+            if (i_len > 128)
+                break;
             printf("SCSI_IDENT_%s_VENDOR=", assoc_str);
             if ((2 == c_set) || (3 == c_set)) { /* ASCII or UTF-8 */
                 k = encode_whitespaces(ip, i_len);
-- 
1.8.4.5

openSUSE Build Service is sponsored by