]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
Update bufflen
authorMohamed Maatallah <hotelsmaatallahrecemail@gmail.com>
Mon, 26 May 2025 09:06:02 +0000 (10:06 +0100)
committerGitHub <noreply@github.com>
Mon, 26 May 2025 09:06:02 +0000 (10:06 +0100)
Update buflen

login-utils/setpwnam.c

index 95e470b5a3401476c858eb2c827a7db71f56a095..7778e98f7cc080da2af1f61a8c6e27ade366b431 100644 (file)
@@ -99,7 +99,8 @@ int setpwnam(struct passwd *pwd, const char *prefix)
                goto fail;
 
        namelen = strlen(pwd->pw_name);
-
+       if (namelen > buflen)
+               buflen += namelen;
        linebuf = malloc(buflen);
        if (!linebuf)
                goto fail;