]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
afs: Fix check for NULL terminator
authorLeo Stone <leocstone@gmail.com>
Mon, 21 Jul 2025 14:29:12 +0000 (15:29 +0100)
committerChristian Brauner <brauner@kernel.org>
Wed, 23 Jul 2025 11:54:05 +0000 (13:54 +0200)
Add a missing check for reaching the end of the string while attempting
to split a command.

Fixes: f94f70d39cc2 ("afs: Provide a way to configure address priorities")
Reported-by: syzbot+7741f872f3c53385a2e2@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=7741f872f3c53385a2e2
Signed-off-by: Leo Stone <leocstone@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/4119428.1753108152@warthog.procyon.org.uk
Acked-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/afs/addr_prefs.c

index c0384201b8feb5c24048509acd174bb22a20be00..133736412c3d76ee46370a621f13e3f2b7198ac2 100644 (file)
@@ -48,7 +48,7 @@ static int afs_split_string(char **pbuf, char *strv[], unsigned int maxstrv)
                strv[count++] = p;
 
                /* Skip over word */
-               while (!isspace(*p))
+               while (!isspace(*p) && *p)
                        p++;
                if (!*p)
                        break;