summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--src/mystring.c7
2 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 60bdfb5..47a4bb0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-10-17  Oleg Verych <olecom@flower.upol.cz>
+
+	* Disallow completely blank strings in non-arithmetic context.
+
 2007-10-15  Herbert Xu <herbert@gondor.apana.org.au>
 
 	* Fixed execing of scripts with no hash-bang.
diff --git a/src/mystring.c b/src/mystring.c
index b84b7e2..8e1200a 100644
--- a/src/mystring.c
+++ b/src/mystring.c
@@ -123,6 +123,13 @@ intmax_t atomax(const char *s, int base)
 	if (errno != 0)
 		sh_error(illnum, s);
 
+	/*
+	 * Disallow completely blank strings in non-arithmetic (base != 0)
+	 * contexts.
+	 */
+	if (base && (p == s))
+		sh_error(illnum, s);
+
 	while (isspace((unsigned char)*p))
 	      p++;