This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e80fee2
)
nl_langinfo code can be negative.
author
Jarkko Hietaniemi
<jhi@iki.fi>
Thu, 25 Jun 2015 12:41:13 +0000
(08:41 -0400)
committer
Jarkko Hietaniemi
<jhi@iki.fi>
Sat, 27 Jun 2015 03:09:44 +0000
(23:09 -0400)
Coverity CID 104814.
ext/I18N-Langinfo/Langinfo.xs
patch
|
blob
|
blame
|
history
diff --git
a/ext/I18N-Langinfo/Langinfo.xs
b/ext/I18N-Langinfo/Langinfo.xs
index
8b1fd5a
..
582b7fa
100644
(file)
--- a/
ext/I18N-Langinfo/Langinfo.xs
+++ b/
ext/I18N-Langinfo/Langinfo.xs
@@
-23,7
+23,12
@@
langinfo(code)
PROTOTYPE: _
CODE:
#ifdef HAS_NL_LANGINFO
- RETVAL = newSVpv(nl_langinfo(code), 0);
+ if (code < 0) {
+ SETERRNO(EINVAL, LIB_INVARG);
+ RETVAL = &PL_sv_undef;
+ } else {
+ RETVAL = newSVpv(nl_langinfo(code), 0);
+ }
#else
croak("nl_langinfo() not implemented on this architecture");
#endif