Skip to content

Commit

Permalink
nl_langinfo code can be negative.
Browse files Browse the repository at this point in the history
Coverity CID 104814.
  • Loading branch information
jhi committed Jun 27, 2015
1 parent e80fee2 commit 0c82d9a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ext/I18N-Langinfo/Langinfo.xs
Expand Up @@ -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
Expand Down

0 comments on commit 0c82d9a

Please sign in to comment.