Mercurial > dropbear
diff dbhelpers.c @ 1580:7f2be495dff6 coverity
merge coverity
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 04 Mar 2018 15:07:09 +0800 |
parents | e75dab5bec71 |
children |
line wrap: on
line diff
--- a/dbhelpers.c Mon Feb 26 22:43:12 2018 +0800 +++ b/dbhelpers.c Sun Mar 04 15:07:09 2018 +0800 @@ -9,16 +9,9 @@ #elif defined(HAVE_EXPLICIT_BZERO) explicit_bzero(data, len); #else -/* Based on the method in David Wheeler's - * "Secure Programming for Linux and Unix HOWTO". May not be safe - * against link-time optimisation. */ - volatile char *p = data; - - if (data == NULL) - return; - while (len--) { - *p++ = 0x0; - } + /* This must be volatile to avoid compiler optimisation */ + volatile void *p = data; + memset((void*)p, 0x0, len); #endif }