Skip to contentSkip to conversation

afs: Fix check for NULL terminator

PATCH Applied David Howells 2 participants 2 messages Jul 21, 2025 – Jul 23, 2025

Subsystems (2)
lore
Share & tools
lore

David Howells

author maintainer
#0 lore raw

PATCH 1/1 afs: Fix check for NULL terminator

From: Leo Stone <[email protected]>

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 [email protected]
cc Marc Dionne <[email protected]>
---
 fs/afs/addr_prefs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/afs/addr_prefs.c +1 -1
index c0384201b8fe..133736412c3d 100644
@@ -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;
maintainer Applied
#1 lore raw
Quoted 4 lines · David Howells

Add a missing check for reaching the end of the string while attempting to split a command.

Applied to the vfs.fixes branch of the vfs/vfs.git tree. Patches in the vfs.fixes branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes

[1/1] afs: Fix check for NULL terminator

      https://git.kernel.org/vfs/vfs/c/9aa64182952d