summaryrefslogtreecommitdiff
path: root/backend/ibm.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-10-08 12:32:49 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-10-08 12:32:49 +0200
commitcfd27ef2ad8b005fd47ab41ef29b71d9e3d48201 (patch)
tree56cb8849a5df91b19b72fd4f48c79c343cd9bc5e /backend/ibm.c
parentba8d09abe681600aad991f4a75e904615b7ed29f (diff)
Imported Upstream version 1.0.25upstream/1.0.25
Diffstat (limited to 'backend/ibm.c')
-rw-r--r--backend/ibm.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/backend/ibm.c b/backend/ibm.c
index 729c140..3ab7890 100644
--- a/backend/ibm.c
+++ b/backend/ibm.c
@@ -248,11 +248,13 @@ attach (const char *devnam, Ibm_Device ** devp)
dev->sane.name = strdup (devnam);
dev->sane.vendor = "IBM";
- str = malloc (16 + 1);
- memset (str, 0, sizeof (str));
- strncpy (str, (char *)ibuf.product, sizeof(ibuf.product));
- strncpy (str + sizeof(ibuf.revision), (char *)ibuf.revision, sizeof(ibuf.revision));
- str[sizeof(ibuf.product) + sizeof(ibuf.revision)] = '\0';
+ str = malloc (sizeof(ibuf.product) + sizeof(ibuf.revision) + 1);
+ if (str)
+ {
+ str[0] = '\0';
+ strncat (str, (char *)ibuf.product, sizeof(ibuf.product));
+ strncat (str, (char *)ibuf.revision, sizeof(ibuf.revision));
+ }
dev->sane.model = str;
dev->sane.type = "flatbed scanner";