summaryrefslogtreecommitdiff
path: root/libbb/obscure.c
diff options
context:
space:
mode:
authorEric Andersen2003-08-06 08:33:08 +0000
committerEric Andersen2003-08-06 08:33:08 +0000
commit481772a4c2915bfca8099218d458bb22906e71b5 (patch)
tree51373431d6a79fdc734f4a913af84a4b35940926 /libbb/obscure.c
parent5378fbcb3358e9ea06d53453e5d677b96a9d9228 (diff)
downloadbusybox-481772a4c2915bfca8099218d458bb22906e71b5.zip
busybox-481772a4c2915bfca8099218d458bb22906e71b5.tar.gz
Patch from vodz to cleanup libbb/obscure.c:password_check()
to not copy too much data.
Diffstat (limited to 'libbb/obscure.c')
-rw-r--r--libbb/obscure.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libbb/obscure.c b/libbb/obscure.c
index 537d448..aa15e40 100644
--- a/libbb/obscure.c
+++ b/libbb/obscure.c
@@ -144,8 +144,8 @@ password_check(const char *old, const char *newval, const struct passwd *pwdp)
msg = NULL;
newmono = str_lower(bb_xstrdup(newval));
- lenwrap = strlen(old) * 2 + 1;
- wrapped = (char *) xmalloc(lenwrap);
+ lenwrap = strlen(old);
+ wrapped = (char *) xmalloc(lenwrap * 2 + 1);
str_lower(strcpy(wrapped, old));
if (palindrome(newmono))
@@ -164,7 +164,7 @@ password_check(const char *old, const char *newval, const struct passwd *pwdp)
}
bzero(newmono, strlen(newmono));
- bzero(wrapped, lenwrap);
+ bzero(wrapped, lenwrap * 2);
free(newmono);
free(wrapped);