public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Added Restriction on base value
@ 2018-08-13 7:44 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2018-08-13 7:44 UTC (permalink / raw)
To: newlib-cvs
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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-08-13 7:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-13 7:44 [newlib-cygwin] Added Restriction on base value Corinna Vinschen
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).