[PATCH] nfs: Fix ln option processing.

Gedare Bloom gedare at rtems.org
Thu Sep 5 17:49:01 UTC 2013


If opts is NULL, then strchr() will dereference it and search for 's'.

1063863 Dereference after null check
---
 cpukit/libfs/src/nfsclient/src/dirutils.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/cpukit/libfs/src/nfsclient/src/dirutils.c b/cpukit/libfs/src/nfsclient/src/dirutils.c
index 65e2053..d5fd1be 100644
--- a/cpukit/libfs/src/nfsclient/src/dirutils.c
+++ b/cpukit/libfs/src/nfsclient/src/dirutils.c
@@ -326,7 +326,7 @@ ln(char *to, char *name, char *opts)
 		}
 		name++;
 	}
-	if (opts || strchr(opts,'s')) {
+	if (opts && strchr(opts,'s')) {
 		if (symlink(name,to)) {
 			fprintf(stderr,"symlink: %s\n",strerror(errno));
 			return -1;
-- 
1.7.1




More information about the devel mailing list