diff options
Diffstat (limited to 'libbb/obscure.c')
-rw-r--r-- | libbb/obscure.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libbb/obscure.c b/libbb/obscure.c index 5cc906235..1841b27d6 100644 --- a/libbb/obscure.c +++ b/libbb/obscure.c | |||
@@ -93,7 +93,7 @@ static const char *obscure_msg(const char *old_p, const char *new_p, const struc | |||
93 | /* Add 2 for each type of characters to the minlen of password */ | 93 | /* Add 2 for each type of characters to the minlen of password */ |
94 | int size = CONFIG_PASSWORD_MINLEN + 8; | 94 | int size = CONFIG_PASSWORD_MINLEN + 8; |
95 | const char *p; | 95 | const char *p; |
96 | char hostname[255]; | 96 | char *hostname; |
97 | 97 | ||
98 | /* size */ | 98 | /* size */ |
99 | if (!new_p || (length = strlen(new_p)) < CONFIG_PASSWORD_MINLEN) | 99 | if (!new_p || (length = strlen(new_p)) < CONFIG_PASSWORD_MINLEN) |
@@ -108,12 +108,11 @@ static const char *obscure_msg(const char *old_p, const char *new_p, const struc | |||
108 | return "similar to gecos"; | 108 | return "similar to gecos"; |
109 | } | 109 | } |
110 | /* hostname as-is, as sub-string, reversed, capitalized, doubled */ | 110 | /* hostname as-is, as sub-string, reversed, capitalized, doubled */ |
111 | if (gethostname(hostname, 255) == 0) { | 111 | hostname = safe_gethostname(); |
112 | hostname[254] = '\0'; | 112 | i = string_checker(new_p, hostname); |
113 | if (string_checker(new_p, hostname)) { | 113 | free(hostname); |
114 | return "similar to hostname"; | 114 | if (i) |
115 | } | 115 | return "similar to hostname"; |
116 | } | ||
117 | 116 | ||
118 | /* Should / Must contain a mix of: */ | 117 | /* Should / Must contain a mix of: */ |
119 | for (i = 0; i < length; i++) { | 118 | for (i = 0; i < length; i++) { |