summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/tinylogin/tinylogin-1.4/passwd_rotate_check.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/tinylogin/tinylogin-1.4/passwd_rotate_check.patch')
-rw-r--r--meta/recipes-core/tinylogin/tinylogin-1.4/passwd_rotate_check.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/meta/recipes-core/tinylogin/tinylogin-1.4/passwd_rotate_check.patch b/meta/recipes-core/tinylogin/tinylogin-1.4/passwd_rotate_check.patch
new file mode 100644
index 0000000000..c602493afc
--- /dev/null
+++ b/meta/recipes-core/tinylogin/tinylogin-1.4/passwd_rotate_check.patch
@@ -0,0 +1,39 @@
1Fix rotate check logic
2
3Rotate passwd checking code has logic error, which writes data into
4un-allocated memory. This patch fixes the issue.
5
6Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
7
8diff --git a/libbb/obscure.c b/libbb/obscure.c
9index 750b611..4a07b5f 100644
10--- a/libbb/obscure.c
11+++ b/libbb/obscure.c
12@@ -135,7 +135,7 @@ password_check(const char *old, const char *newval, const struct passwd *pwdp)
13 {
14 const char *msg;
15 char *newmono, *wrapped;
16- int lenwrap;
17+ int lenold, lenwrap;
18
19 if (strcmp(newval, old) == 0)
20 return "no change";
21@@ -144,7 +144,8 @@ password_check(const char *old, const char *newval, const struct passwd *pwdp)
22
23 msg = NULL;
24 newmono = str_lower(xstrdup(newval));
25- lenwrap = strlen(old) * 2 + 1;
26+ lenold = strlen(old);
27+ lenwrap = lenold * 2 + 1;
28 wrapped = (char *) xmalloc(lenwrap);
29 str_lower(strcpy(wrapped, old));
30
31@@ -158,7 +159,7 @@ password_check(const char *old, const char *newval, const struct passwd *pwdp)
32 msg = "too similiar";
33
34 else {
35- safe_strncpy(wrapped + lenwrap, wrapped, lenwrap + 1);
36+ safe_strncpy(wrapped + lenold, wrapped, lenold + 1);
37 if (strstr(wrapped, newmono))
38 msg = "rotated";
39 }