comparison 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
comparison
equal deleted inserted replaced
1545:0b991dec7ab9 1580:7f2be495dff6
7 #if defined(HAVE_MEMSET_S) 7 #if defined(HAVE_MEMSET_S)
8 memset_s(data, len, 0x0, len); 8 memset_s(data, len, 0x0, len);
9 #elif defined(HAVE_EXPLICIT_BZERO) 9 #elif defined(HAVE_EXPLICIT_BZERO)
10 explicit_bzero(data, len); 10 explicit_bzero(data, len);
11 #else 11 #else
12 /* Based on the method in David Wheeler's 12 /* This must be volatile to avoid compiler optimisation */
13 * "Secure Programming for Linux and Unix HOWTO". May not be safe 13 volatile void *p = data;
14 * against link-time optimisation. */ 14 memset((void*)p, 0x0, len);
15 volatile char *p = data;
16
17 if (data == NULL)
18 return;
19 while (len--) {
20 *p++ = 0x0;
21 }
22 #endif 15 #endif
23 } 16 }
24 17
25 18