Re: com php-src: check emalloc() result: ext/standard/http_fopen_wrapper.c

From: Date: Sat, 13 Sep 2014 21:35:32 +0000
Subject: Re: com php-src: check emalloc() result: ext/standard/http_fopen_wrapper.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-81563@lists.php.net to get a copy of this message
On Sat, Sep 13, 2014 at 11:21 PM, Anatol Belski <ab@php.net> wrote: > Commit: bce562b75efcdacc762a3b94915cdf02056b22dc > Author: Anatol Belski <ab@php.net> Sat, 13 Sep 2014 20:20:17 > +0200 > Parents: e00d48490bbba38a2757b28dfd930dbdf4870331 > Branches: master > > Link: > > http://git.php.net/?p=php-src.git;a=commitdiff;h=bce562b75efcdacc762a3b94915cdf02056b22dc > > Log: > check emalloc() result > > Changed paths: > M ext/standard/http_fopen_wrapper.c > > > Diff: > diff --git a/ext/standard/http_fopen_wrapper.c > b/ext/standard/http_fopen_wrapper.c > index 45fa637..d7b62e1 100644 > --- a/ext/standard/http_fopen_wrapper.c > +++ b/ext/standard/http_fopen_wrapper.c > @@ -587,6 +587,9 @@ finish: > /* ensure the header is only sent if user_agent is not > blank */ > if (ua_len > sizeof(_UA_HEADER)) { > ua = emalloc(ua_len + 1); > + if (NULL == ua) { > + return NULL; > + } > if ((ua_len = slprintf(ua, ua_len, _UA_HEADER, > ua_str)) > 0) { > ua[ua_len] = 0; > php_stream_write(stream, ua, ua_len); > emalloc is an infallible allocator, no need to check it for NULL. Nikita

« previous php.cvs (#81563) next »