diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2013-11-19 13:36:45 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-11-19 13:36:45 +0100 |
commit | 8b59b2c13ededb2c82e36193b6d6e969df36531c (patch) | |
tree | 7b5065279d3c5a6c8bd0ca90584d49bb73aac01c /libbb | |
parent | 6ef77291122d231754e7292630681dc67c109d60 (diff) | |
download | busybox-w32-8b59b2c13ededb2c82e36193b6d6e969df36531c.tar.gz busybox-w32-8b59b2c13ededb2c82e36193b6d6e969df36531c.tar.bz2 busybox-w32-8b59b2c13ededb2c82e36193b6d6e969df36531c.zip |
libbb: move nuke_str() from passwd into libbb
function old new delta
nuke_str - 15 +15
ask_and_check_password_extended 215 206 -9
init_main 781 771 -10
nuke_str 27 - -27
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/2 up/down: 15/-46) Total: -31 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/correct_password.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libbb/correct_password.c b/libbb/correct_password.c index d39a5839c..5727c65fb 100644 --- a/libbb/correct_password.c +++ b/libbb/correct_password.c | |||
@@ -30,6 +30,15 @@ | |||
30 | 30 | ||
31 | #include "libbb.h" | 31 | #include "libbb.h" |
32 | 32 | ||
33 | void FAST_FUNC nuke_str(char *str) | ||
34 | { | ||
35 | if (str) { | ||
36 | while (*str) | ||
37 | *str++ = 0; | ||
38 | /* or: memset(str, 0, strlen(str)); - not as small as above */ | ||
39 | } | ||
40 | } | ||
41 | |||
33 | /* Ask the user for a password. | 42 | /* Ask the user for a password. |
34 | * Return 1 without asking if PW has an empty password. | 43 | * Return 1 without asking if PW has an empty password. |
35 | * Return -1 on EOF, error while reading input, or timeout. | 44 | * Return -1 on EOF, error while reading input, or timeout. |
@@ -76,7 +85,7 @@ int FAST_FUNC ask_and_check_password_extended(const struct passwd *pw, | |||
76 | encrypted = pw_encrypt(unencrypted, correct, 1); | 85 | encrypted = pw_encrypt(unencrypted, correct, 1); |
77 | r = (strcmp(encrypted, correct) == 0); | 86 | r = (strcmp(encrypted, correct) == 0); |
78 | free(encrypted); | 87 | free(encrypted); |
79 | memset(unencrypted, 0, strlen(unencrypted)); | 88 | nuke_str(unencrypted); |
80 | return r; | 89 | return r; |
81 | } | 90 | } |
82 | 91 | ||