mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 01:18:00 +00:00
New utility function burnwcs().
Just like burnstr(), it memsets a NUL-terminated string to all zeroes before freeing it. The only difference is that it does it to a string of wchar_t.
This commit is contained in:
parent
1625fd8fcb
commit
dbd0bde415
1
misc.h
1
misc.h
@ -31,6 +31,7 @@ char *dupcat_fn(const char *s1, ...);
|
||||
char *dupprintf(const char *fmt, ...) PRINTF_LIKE(1, 2);
|
||||
char *dupvprintf(const char *fmt, va_list ap);
|
||||
void burnstr(char *string);
|
||||
void burnwcs(wchar_t *string);
|
||||
|
||||
/*
|
||||
* The visible part of a strbuf structure. There's a surrounding
|
||||
|
@ -9,6 +9,7 @@ add_sources_from_current_dir(utils
|
||||
bufchain.c
|
||||
buildinfo.c
|
||||
burnstr.c
|
||||
burnwcs.c
|
||||
cert-expr.c
|
||||
chomp.c
|
||||
cmdline_get_passwd_input_state_new.c
|
||||
|
18
utils/burnwcs.c
Normal file
18
utils/burnwcs.c
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 'Burn' a dynamically allocated wide string, in the sense of
|
||||
* destroying it beyond recovery: overwrite it with zeroes and then
|
||||
* free it.
|
||||
*/
|
||||
|
||||
#include <wchar.h>
|
||||
|
||||
#include "defs.h"
|
||||
#include "misc.h"
|
||||
|
||||
void burnwcs(wchar_t *string)
|
||||
{
|
||||
if (string) {
|
||||
smemclr(string, sizeof(*string) * wcslen(string));
|
||||
sfree(string);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user