diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2003-01-16 20:48:10 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2003-01-16 20:48:10 +0000 |
commit | 0de8cad8cba777e31f98ef8b8ac579070f7c78a6 (patch) | |
tree | 4033edd272152aff5998dcd557a1adaa6ab2d543 /reentr.pl | |
parent | 13ef5feb3a8e2368992adc7df8455949512b60b3 (diff) | |
download | perl-0de8cad8cba777e31f98ef8b8ac579070f7c78a6.tar.gz |
Integrate changes #18422 and #18423 from maint-5.8.
18422 :
Third Degree found a read of uninit memory (after setting
grent_size with sysconf(), pwent_size was read). Also make
the ERANGE/INVARG more consistent.
18423 :
spent_size was still off. (As far as I can tell
_SC_GETPW_R_SIZE_MAX is supposed to be used also
for spents, not just pwents.)
p4raw-link: @18422 on //depot/maint-5.8/perl: c45c44aa17d6498a967957363477eb572b803726
p4raw-id: //depot/perl@18498
p4raw-integrated: from //depot/maint-5.8/perl@18497 'copy in' reentr.h
(@17645..) reentr.c reentr.pl (@18422..)
Diffstat (limited to 'reentr.pl')
-rw-r--r-- | reentr.pl | 35 |
1 files changed, 15 insertions, 20 deletions
@@ -493,43 +493,36 @@ EOF $seent{$func}* _${genfunc}_ptr; # endif EOF - if ($genfunc eq 'getspent') { - push @size, <<EOF; - PL_reentrant_buffer->_${genfunc}_size = 1024; -EOF - } else { - push @struct, <<EOF; + push @struct, <<EOF; # ifdef USE_${GENFUNC}_FPTR FILE* _${genfunc}_fptr; # endif EOF - push @init, <<EOF; + push @init, <<EOF; # ifdef USE_${GENFUNC}_FPTR PL_reentrant_buffer->_${genfunc}_fptr = NULL; # endif EOF - my $sc = $genfunc eq 'getgrent' ? + my $sc = $genfunc eq 'grent' ? '_SC_GETGR_R_SIZE_MAX' : '_SC_GETPW_R_SIZE_MAX'; - my $sz = $genfunc eq 'getgrent' ? - '_grent_size' : '_pwent_size'; - push @size, <<EOF; + my $sz = "_${genfunc}_size"; + push @size, <<EOF; # if defined(HAS_SYSCONF) && defined($sc) && !defined(__GLIBC__) - PL_reentrant_buffer->_${genfunc}_size = sysconf($sc); + PL_reentrant_buffer->$sz = sysconf($sc); if (PL_reentrant_buffer->$sz == -1) PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE; # else # if defined(__osf__) && defined(__alpha) && defined(SIABUFSIZ) - PL_reentrant_buffer->_${genfunc}_size = SIABUFSIZ; + PL_reentrant_buffer->$sz = SIABUFSIZ; # else # ifdef __sgi - PL_reentrant_buffer->_${genfunc}_size = BUFSIZ; + PL_reentrant_buffer->$sz = BUFSIZ; # else - PL_reentrant_buffer->_${genfunc}_size = REENTRANTUSUALSIZE; + PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE; # endif # endif # endif EOF - } pushinitfree $genfunc; pushssif $endif; } @@ -814,6 +807,7 @@ Perl_reentrant_retry(const char *f, ...) case OP_GHOSTENT: retptr = gethostent(); break; default: + SETERRNO(ERANGE, LIB_INVARG); break; } } @@ -844,6 +838,7 @@ Perl_reentrant_retry(const char *f, ...) case OP_GGRENT: retptr = getgrent(); break; default: + SETERRNO(ERANGE, LIB_INVARG); break; } } @@ -875,10 +870,10 @@ Perl_reentrant_retry(const char *f, ...) case OP_GNETENT: retptr = getnetent(); break; default: + SETERRNO(ERANGE, LIB_INVARG); break; } } - SETERRNO(ERANGE, LIB_INVARG); } break; #endif @@ -906,10 +901,10 @@ Perl_reentrant_retry(const char *f, ...) case OP_GPWENT: retptr = getpwent(); break; default: + SETERRNO(ERANGE, LIB_INVARG); break; } } - SETERRNO(ERANGE, LIB_INVARG); } break; #endif @@ -936,10 +931,10 @@ Perl_reentrant_retry(const char *f, ...) case OP_GPROTOENT: retptr = getprotoent(); break; default: + SETERRNO(ERANGE, LIB_INVARG); break; } } - SETERRNO(ERANGE, LIB_INVARG); } break; #endif @@ -968,10 +963,10 @@ Perl_reentrant_retry(const char *f, ...) case OP_GSERVENT: retptr = getservent(); break; default: + SETERRNO(ERANGE, LIB_INVARG); break; } } - SETERRNO(ERANGE, LIB_INVARG); } break; #endif |