You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by sf...@apache.org on 2014/05/10 12:28:49 UTC

svn commit: r1593681 - in /apr/apr/branches/1.6.x: ./ strings/apr_cpystrn.c

Author: sf
Date: Sat May 10 10:28:48 2014
New Revision: 1593681

URL: http://svn.apache.org/r1593681
Log:
Backport r1593680 from trunk:

  Fix NULL pointer dereference if out of mem
  in strdup() fallback function

  PR: 56385

Modified:
    apr/apr/branches/1.6.x/   (props changed)
    apr/apr/branches/1.6.x/strings/apr_cpystrn.c

Propchange: apr/apr/branches/1.6.x/
------------------------------------------------------------------------------
  Merged /apr/apr/trunk:r1593680

Modified: apr/apr/branches/1.6.x/strings/apr_cpystrn.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/strings/apr_cpystrn.c?rev=1593681&r1=1593680&r2=1593681&view=diff
==============================================================================
--- apr/apr/branches/1.6.x/strings/apr_cpystrn.c (original)
+++ apr/apr/branches/1.6.x/strings/apr_cpystrn.c Sat May 10 10:28:48 2014
@@ -235,6 +235,8 @@ char *strdup(const char *str)
     size_t len = strlen(str) + 1;
 
     sdup = (char *) malloc(len);
+    if (sdup == NULL)
+        return NULL;
     memcpy(sdup, str, len);
 
     return sdup;