From b7a2dfb2da79c68a5353762fa7b6a8227a792aa3 Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Sun, 13 Jan 2013 08:37:54 +0000 Subject: [PATCH] 2013-01-13 Chris Allegretta * 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 --- ChangeLog | 7 ++++++- src/utils.c | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b3c2eafe..af77bda6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ -2013-01-02 Mike Frysinger +2013-01-13 Chris Allegretta + * 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 * configure.ac: Check for ncursesw5-config and base $CPPFLAGS based on it. 2013-01-09 Fabian Groffen diff --git a/src/utils.c b/src/utils.c index 220204ac..044488af 100644 --- 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') -- 2.39.5