sane-backends/dell1600n_net-fix-strncat.patch

39 lines
1.3 KiB
Diff

--- backend/dell1600n_net.c.orig 2013-02-23 03:00:56.000000000 +0100
+++ backend/dell1600n_net.c 2015-10-06 10:44:01.000000000 +0200
@@ -943,7 +943,7 @@ HexDump (int debugLevel, const unsigned
sprintf (itemBuf, "%02x ", (const unsigned int) buf[i]);
- strncat (lineBuf, itemBuf, sizeof (lineBuf));
+ strncat (lineBuf, itemBuf, sizeof (lineBuf) - strlen (lineBuf) - 1);
if ((i + 1) % 16)
continue;
@@ -960,7 +960,7 @@ HexDump (int debugLevel, const unsigned
{
sprintf (itemBuf, ".");
}
- strncat (lineBuf, itemBuf, sizeof (lineBuf));
+ strncat (lineBuf, itemBuf, sizeof (lineBuf) - strlen (lineBuf) - 1);
} /* for j */
@@ -974,7 +974,7 @@ HexDump (int debugLevel, const unsigned
for (j = (i % 16); j < 16; ++j)
{
- strncat (lineBuf, " ", sizeof (lineBuf));
+ strncat (lineBuf, " ", sizeof (lineBuf) - strlen (lineBuf) - 1);
}
for (j = 1 + i - ((i + 1) % 16); j < i; ++j)
{
@@ -986,7 +986,7 @@ HexDump (int debugLevel, const unsigned
{
strcpy (itemBuf, ".");
}
- strncat (lineBuf, itemBuf, sizeof (lineBuf));
+ strncat (lineBuf, itemBuf, sizeof (lineBuf) - strlen (lineBuf) - 1);
}
DBG (debugLevel, "%s\n", lineBuf);
}