]> granicus.if.org Git - php/commitdiff
check emalloc() result
authorAnatol Belski <ab@php.net>
Sat, 13 Sep 2014 18:20:17 +0000 (20:20 +0200)
committerAnatol Belski <ab@php.net>
Sat, 13 Sep 2014 21:21:47 +0000 (23:21 +0200)
ext/standard/http_fopen_wrapper.c

index 45fa637c0de40ca47929109d7598e0ff4a65752b..d7b62e186d0cca995892a60e5baa285ed5501548 100644 (file)
@@ -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);