diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-05-24 21:03:56 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-05-24 21:03:56 +0200 |
commit | 58912f68c2489bcee787599837447e0d64dfd61a (patch) | |
tree | dda50aadde35fe152da1a8d50769987ace0f1496 /backend/dell1600n_net.c | |
parent | cfd27ef2ad8b005fd47ab41ef29b71d9e3d48201 (diff) |
New upstream version 1.0.27upstream/1.0.27
Diffstat (limited to 'backend/dell1600n_net.c')
-rw-r--r-- | backend/dell1600n_net.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/backend/dell1600n_net.c b/backend/dell1600n_net.c index d19059b..3586215 100644 --- a/backend/dell1600n_net.c +++ b/backend/dell1600n_net.c @@ -929,6 +929,7 @@ HexDump (int debugLevel, const unsigned char *buf, size_t bufSize) { unsigned int i, j; + size_t lineBufFree; char itemBuf[16] = { 0 }, lineBuf[256] = { 0 }; @@ -943,7 +944,8 @@ HexDump (int debugLevel, const unsigned char *buf, size_t bufSize) sprintf (itemBuf, "%02x ", (const unsigned int) buf[i]); - strncat (lineBuf, itemBuf, sizeof (lineBuf)); + lineBufFree = sizeof (lineBuf) - strlen (lineBuf) - 1; + strncat (lineBuf, itemBuf, lineBufFree); if ((i + 1) % 16) continue; @@ -960,7 +962,8 @@ HexDump (int debugLevel, const unsigned char *buf, size_t bufSize) { sprintf (itemBuf, "."); } - strncat (lineBuf, itemBuf, sizeof (lineBuf)); + lineBufFree = sizeof (lineBuf) - strlen (lineBuf) - 1; + strncat (lineBuf, itemBuf, lineBufFree); } /* for j */ @@ -974,7 +977,8 @@ HexDump (int debugLevel, const unsigned char *buf, size_t bufSize) for (j = (i % 16); j < 16; ++j) { - strncat (lineBuf, " ", sizeof (lineBuf)); + lineBufFree = sizeof (lineBuf) - strlen (lineBuf) - 1; + strncat (lineBuf, " ", lineBufFree); } for (j = 1 + i - ((i + 1) % 16); j < i; ++j) { @@ -986,7 +990,8 @@ HexDump (int debugLevel, const unsigned char *buf, size_t bufSize) { strcpy (itemBuf, "."); } - strncat (lineBuf, itemBuf, sizeof (lineBuf)); + lineBufFree = sizeof (lineBuf) - strlen (lineBuf) - 1; + strncat (lineBuf, itemBuf, lineBufFree); } DBG (debugLevel, "%s\n", lineBuf); } @@ -1335,7 +1340,7 @@ ProcessUdpResponse (unsigned char *pData, size_t size, { unsigned short messageSize, nameSize, valueSize; - unsigned char *pItem, *pEnd, *pValue; + unsigned char *pItem, *pEnd; char sockBuf[SOCK_BUF_SIZE], *pName; struct ComBuf tcpBuf; int nread; @@ -1376,8 +1381,6 @@ ProcessUdpResponse (unsigned char *pData, size_t size, valueSize = (((unsigned short) pItem[0]) << 8) | pItem[1]; pItem += 2; - pValue = pItem; - pItem += valueSize; /* process the item */ |