[PATCH] afs: check for NULL terminator
From: Leo Stone
Date: Tue Dec 17 2024 - 14:11:25 EST
Add a missing check for reaching the end of the string while attempting
to split a command.
Reported-by: syzbot+7741f872f3c53385a2e2@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://syzkaller.appspot.com/bug?extid=7741f872f3c53385a2e2
Signed-off-by: Leo Stone <leocstone@xxxxxxxxx>
---
fs/afs/addr_prefs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/afs/addr_prefs.c b/fs/afs/addr_prefs.c
index a189ff8a5034..4f8553aa5931 100644
--- a/fs/afs/addr_prefs.c
+++ b/fs/afs/addr_prefs.c
@@ -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;
--
2.43.0