[ibsim patch 12/23] sim_cmd.c: sim_cmd_file should check the char pointer before dereferening

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Honggang Li <honli@xxxxxxxxxx>
---
 ibsim/sim_cmd.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ibsim/sim_cmd.c b/ibsim/sim_cmd.c
index 1d36c600814f..0a94c68bdf21 100644
--- a/ibsim/sim_cmd.c
+++ b/ibsim/sim_cmd.c
@@ -1149,11 +1149,16 @@ int sim_cmd_file(FILE * f, char *s)
 	FILE *cmd_file;
 	char *p;
 
+	if (!s) {
+		fprintf(f, "do_cmd_from_file: no file name - skip\n");
+		return -1;
+	}
+
 	s++;
 	while (isspace(*s))
 		s++;
 
-	if (!s || !*s) {
+	if (!*s) {
 		fprintf(f, "do_cmd_from_file: no file name - skip\n");
 		return -1;
 	}
-- 
2.15.0-rc1




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux