Skip to contentSkip to conversation

arch: ia64: hp: sim: sprintf() memory overflow, need really use the default value just as it has already said.

PATCH New Chen Gang 1 participant 1 message May 30, 2013 Generic include/asm header files

lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH 1/1 arch: ia64: hp: sim: sprintf() memory overflow, need really use the default value just as it has already said.

When "strlen(s) > MAX_ROOT_LEN", it has already said to use the default value, but in fact, it still use the input value.

If happens, next sprintf() for 'fname' in simscsi_queuecommand_lck() may be memory overflow.

---
 arch/ia64/hp/sim/simscsi.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/ia64/hp/sim/simscsi.c +2 -2
index 331de72..3a428f1 100644
@@ -88,8 +88,8 @@ simscsi_setup (char *s)
 	if (strlen(s) > MAX_ROOT_LEN) {
 		printk(KERN_ERR "simscsi_setup: prefix too long---using default %s\n",
 		       simscsi_root);
-	}
-	simscsi_root = s;
+	} else
+		simscsi_root = s;
 	return 1;
 }
 
Signature · 1 line
1.7.7.6