From c838853519bb4916de178fe94a2d327c30dbabda Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 5 May 2009 17:20:49 +0000 Subject: Don't clobber the destination of gpsd_hexpack; thanks to Joshua Lamorie for spotting this. --- hex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hex.c') 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 @*/ } -- cgit v1.2.1