public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] Added Restriction on base value
Date: Mon, 13 Aug 2018 07:44:00 -0000	[thread overview]
Message-ID: <20180813074458.16572.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=a9a455472343c04f28661af373b4543268342a25

commit a9a455472343c04f28661af373b4543268342a25
Author: Aditya Upadhyay <aadit0402@gmail.com>
Date:   Sun Aug 12 19:39:52 2018 +0530

    Added Restriction on base value

Diff:
---
 newlib/libc/stdlib/strtoimax.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/newlib/libc/stdlib/strtoimax.c b/newlib/libc/stdlib/strtoimax.c
index 6901612..c3f27df 100644
--- a/newlib/libc/stdlib/strtoimax.c
+++ b/newlib/libc/stdlib/strtoimax.c
@@ -91,6 +91,9 @@ _strtoimax_l(struct _reent *rptr, const char * __restrict nptr,
 	if (base == 0)
 		base = c == '0' ? 8 : 10;
 
+	if (base < 2 || base > 36)
+		goto noconv;
+
 	/*
 	 * Compute the cutoff value between legal numbers and illegal
 	 * numbers.  That is the largest legal value, divided by the
@@ -135,6 +138,7 @@ _strtoimax_l(struct _reent *rptr, const char * __restrict nptr,
 		acc = neg ? INTMAX_MIN : INTMAX_MAX;
 		rptr->_errno = ERANGE;
 	} else if (!any) {
+noconv:
 		rptr->_errno = EINVAL;
 	} else if (neg)
 		acc = -acc;


                 reply	other threads:[~2018-08-13  7:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180813074458.16572.qmail@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).