diff options
-rw-r--r-- | libbb/update_passwd.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libbb/update_passwd.c b/libbb/update_passwd.c index 388adf81f..e99db40c0 100644 --- a/libbb/update_passwd.c +++ b/libbb/update_passwd.c | |||
@@ -52,6 +52,10 @@ int update_passwd(const char *filename, const char *username, | |||
52 | int cnt = 0; | 52 | int cnt = 0; |
53 | int ret = -1; /* failure */ | 53 | int ret = -1; /* failure */ |
54 | 54 | ||
55 | filename = xmalloc_readlink_follow(filename); | ||
56 | if (filename == NULL) | ||
57 | return -1; | ||
58 | |||
55 | check_selinux_update_passwd(username); | 59 | check_selinux_update_passwd(username); |
56 | 60 | ||
57 | /* New passwd file, "/etc/passwd+" for now */ | 61 | /* New passwd file, "/etc/passwd+" for now */ |
@@ -143,6 +147,7 @@ int update_passwd(const char *filename, const char *username, | |||
143 | 147 | ||
144 | free_mem: | 148 | free_mem: |
145 | free(fnamesfx); | 149 | free(fnamesfx); |
146 | free((char*)username); | 150 | free((char *)filename); |
151 | free((char *)username); | ||
147 | return ret; | 152 | return ret; |
148 | } | 153 | } |