commit b7a2dfb2da79c68a5353762fa7b6a8227a792aa3
parent f4e26d174e66252e0382a4d525bb174ff5b7daad
Author: Chris Allegretta <chrisa@asty.org>
Date: Sun, 13 Jan 2013 08:37:54 +0000
2013-01-13 Chris Allegretta <chrisa@asty.org>
* src/utils.c (parse_num): Initalize errno before calling strtol(). Fixes issue
where trying to go to a line number too long will break legitimate goto-lines
for the remainder of the editing session, reported by Joshua Rogers.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4563 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,4 +1,9 @@
-2013-01-02 Mike Frysinger <vapier@gentoo.org>
+2013-01-13 Chris Allegretta <chrisa@asty.org>
+ * src/utils.c (parse_num): Initalize errno before calling strtol(). Fixes issue
+ where trying to go to a line number too long will break legitimate goto-lines
+ for the remainder of the editing session, reported by Joshua Rogers.
+
+2013-01-09 Mike Frysinger <vapier@gentoo.org>
* configure.ac: Check for ncursesw5-config and base $CPPFLAGS based on it.
2013-01-09 Fabian Groffen <grobian@Savannah>
diff --git a/src/utils.c b/src/utils.c
@@ -72,6 +72,10 @@ bool parse_num(const char *str, ssize_t *val)
assert(str != NULL);
+ /* Man page for strtol() says this is required, and
+ it looks like it is! */
+ errno = 0;
+
j = (ssize_t)strtol(str, &first_error, 10);
if (errno == ERANGE || *str == '\0' || *first_error != '\0')