From 93e044c4a68d55266db108a24fb70d9de46eab14 Mon Sep 17 00:00:00 2001
From: Rob Landley <rob@landley.net>
Date: Wed, 13 Jul 2016 13:46:50 -0500
Subject: Bugfix: suffixless string was feeding terminating NUL to strchr() and
 matching.

---
 lib/lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'lib')

diff --git a/lib/lib.c b/lib/lib.c
index 56656435..3f4819fb 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -297,7 +297,7 @@ long long atolx(char *numstr)
   long long val;
 
   val = xstrtol(numstr, &c, 0);
-  if (c != numstr && (end = strchr(suffixes, tolower(*c)))) {
+  if (c != numstr && *c && (end = strchr(suffixes, tolower(*c)))) {
     int shift = end-suffixes-2;
 
     if (shift >= 0) {
-- 
cgit v1.2.3