summaryrefslogtreecommitdiff
path: root/hex.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-05-05 17:20:49 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-05-05 17:20:49 +0000
commitc838853519bb4916de178fe94a2d327c30dbabda (patch)
treeba3d8c0f6c44d0e6c596f475b07da7d7d4da3854 /hex.c
parent827953c4c984711f102b8f03cb976179864efaef (diff)
downloadgpsd-c838853519bb4916de178fe94a2d327c30dbabda.tar.gz
Don't clobber the destination of gpsd_hexpack; thanks to Joshua
Lamorie for spotting this.
Diffstat (limited to 'hex.c')
-rw-r--r--hex.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hex.c b/hex.c
index 5addeaeb..97192c5b 100644
--- a/hex.c
+++ b/hex.c
@@ -61,12 +61,12 @@ int gpsd_hexpack(char *src, char *dst, size_t len){
if ((l < 1) || ((size_t)l > len))
return -2;
- bzero(dst, (int)len);
for (i = 0; i < l; i++)
if ((k = hex2bin(src+i*2)) != -1)
dst[i] = (char)(k & 0xff);
else
return -1;
+ (void)memset(dst+i, '\0', (size_t)(len-i));
return l;
/*@ +mustdefine @*/
}