string-util: introduce explicit_zero_safe()
The only real difference is that this wrapper can deal with NULL pointer arguments, but only if the length is also zero. CID 1396277
This commit is contained in:
@@ -198,8 +198,15 @@ static inline void *memmem_safe(const void *haystack, size_t haystacklen, const
|
||||
return memmem(haystack, haystacklen, needle, needlelen);
|
||||
}
|
||||
|
||||
#if !HAVE_EXPLICIT_BZERO
|
||||
void explicit_bzero(void *p, size_t l);
|
||||
#if HAVE_EXPLICIT_BZERO
|
||||
static inline void* explicit_bzero_safe(void *p, size_t l) {
|
||||
if (l > 0)
|
||||
explicit_bzero(p, l);
|
||||
|
||||
return p;
|
||||
}
|
||||
#else
|
||||
void explicit_bzero_safe(void *p, size_t l);
|
||||
#endif
|
||||
|
||||
char *string_erase(char *x);
|
||||
|
||||
Reference in New Issue
Block a user