1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Another utility function, to free a string containing sensitive data.

[originally from svn r9319]
This commit is contained in:
Simon Tatham 2011-10-02 14:03:47 +00:00
parent 535d77abf0
commit ff5a9c77fd
2 changed files with 9 additions and 0 deletions

8
misc.c
View File

@ -200,6 +200,14 @@ char *dupcat(const char *s1, ...)
return p;
}
void burnstr(char *string) /* sfree(str), only clear it first */
{
if (string) {
memset(string, 0, strlen(string));
sfree(string);
}
}
/*
* Do an sprintf(), but into a custom-allocated buffer.
*

1
misc.h
View File

@ -28,6 +28,7 @@ char *dupstr(const char *s);
char *dupcat(const char *s1, ...);
char *dupprintf(const char *fmt, ...);
char *dupvprintf(const char *fmt, va_list ap);
void burnstr(char *string);
char *fgetline(FILE *fp);