src/pEp_string.c
changeset 2461 85c8e5aad3bc
parent 2376 997e80887f22
child 2462 48b526a0daac
     1.1 --- a/src/pEp_string.c	Mon Jan 15 12:26:14 2018 +0100
     1.2 +++ b/src/pEp_string.c	Mon Jan 29 12:15:51 2018 +0100
     1.3 @@ -1,6 +1,7 @@
     1.4  // This file is under GNU General Public License 3.0
     1.5  // see LICENSE.txt
     1.6  
     1.7 +#include "platform.h"
     1.8  #include "pEp_string.h"
     1.9  
    1.10  #include <stdlib.h>
    1.11 @@ -8,10 +9,6 @@
    1.12  
    1.13  DYNAMIC_API char * new_string(const char *src, size_t len)
    1.14  {
    1.15 -    assert(src || len);
    1.16 -    if (!(src || len))
    1.17 -        return NULL;
    1.18 -
    1.19      char *s = NULL;
    1.20      if (src) {
    1.21          if (len)
    1.22 @@ -21,7 +18,7 @@
    1.23          assert(s);
    1.24      }
    1.25      else {
    1.26 -        s = calloc(1, len);
    1.27 +        s = calloc(1, len + 1);
    1.28          assert(s);
    1.29      }
    1.30