comparison dbutil.c @ 1280:94d4038bb34c

Use memset_s or explicit_bzero
author Matt Johnston <matt@ucc.asn.au>
date Wed, 16 Mar 2016 23:39:39 +0800
parents 2bb4c662d1c2
children 3017bc7d6238
comparison
equal deleted inserted replaced
1279:f107cef4be68 1280:94d4038bb34c
562 /* Clear the data, based on the method in David Wheeler's 562 /* Clear the data, based on the method in David Wheeler's
563 * "Secure Programming for Linux and Unix HOWTO" */ 563 * "Secure Programming for Linux and Unix HOWTO" */
564 /* Beware of calling this from within dbutil.c - things might get 564 /* Beware of calling this from within dbutil.c - things might get
565 * optimised away */ 565 * optimised away */
566 void m_burn(void *data, unsigned int len) { 566 void m_burn(void *data, unsigned int len) {
567
568 #if defined(HAVE_MEMSET_S)
569 memset_s(data, len, 0x0, len);
570 #elif defined(HAVE_EXPLICIT_BZERO)
571 explicit_bzero(data, len);
572 #else
567 volatile char *p = data; 573 volatile char *p = data;
568 574
569 if (data == NULL) 575 if (data == NULL)
570 return; 576 return;
571 while (len--) { 577 while (len--) {
572 *p++ = 0x0; 578 *p++ = 0x0;
573 } 579 }
580 #endif
574 } 581 }
575 582
576 583
577 void setnonblocking(int fd) { 584 void setnonblocking(int fd) {
578 585