summaryrefslogtreecommitdiff
path: root/backend/ricoh.c
diff options
context:
space:
mode:
Diffstat (limited to 'backend/ricoh.c')
-rw-r--r--backend/ricoh.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/backend/ricoh.c b/backend/ricoh.c
index 58b3a53..fbe5c58 100644
--- a/backend/ricoh.c
+++ b/backend/ricoh.c
@@ -222,12 +222,14 @@ attach (const char *devnam, Ricoh_Device ** devp)
dev->sane.name = strdup (devnam);
dev->sane.vendor = "RICOH";
- str = malloc (sizeof(ibuf.product) + sizeof(ibuf.revision) + 1);
+
+ size_t prod_rev_size = sizeof(ibuf.product) + sizeof(ibuf.revision) + 1;
+ str = malloc (prod_rev_size);
if (str)
{
- str[0] = '\0';
- strncat (str, (char *)ibuf.product, sizeof(ibuf.product));
- strncat (str, (char *)ibuf.revision, sizeof(ibuf.revision));
+ snprintf (str, prod_rev_size, "%.*s%.*s",
+ (int) sizeof(ibuf.product), (const char *) ibuf.product,
+ (int) sizeof(ibuf.revision), (const char *) ibuf.revision);
}
dev->sane.model = str;
dev->sane.type = "flatbed scanner";