summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mystring.c7
1 files changed, 7 insertions, 0 deletions
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++;