Fix problem in strdup replacement when dealing with absolutely huge strings.
This commit is contained in:
parent
bad6410d08
commit
20e9fc73e2
4
CHANGES
4
CHANGES
@ -6,6 +6,10 @@
|
|||||||
|
|
||||||
Changelog
|
Changelog
|
||||||
|
|
||||||
|
Yang Tse (6 Feb 2008)
|
||||||
|
- Fix an issue in strdup replacement function when dealing with absolutely
|
||||||
|
huge strings. Only systems without a standard strdup would be affected.
|
||||||
|
|
||||||
Daniel S (3 Feb 2008)
|
Daniel S (3 Feb 2008)
|
||||||
- Dmitry Kurochkin cleaned up the pipelining code and removed the need for and
|
- Dmitry Kurochkin cleaned up the pipelining code and removed the need for and
|
||||||
use of the "is_in_pipeline" struct field.
|
use of the "is_in_pipeline" struct field.
|
||||||
|
@ -15,6 +15,7 @@ This release includes the following changes:
|
|||||||
This release includes the following bugfixes:
|
This release includes the following bugfixes:
|
||||||
|
|
||||||
o improved pipelining
|
o improved pipelining
|
||||||
|
o improved strdup replacement
|
||||||
|
|
||||||
This release includes the following known bugs:
|
This release includes the following known bugs:
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -27,13 +27,17 @@
|
|||||||
#ifndef HAVE_STRDUP
|
#ifndef HAVE_STRDUP
|
||||||
char *curlx_strdup(const char *str)
|
char *curlx_strdup(const char *str)
|
||||||
{
|
{
|
||||||
int len;
|
size_t len;
|
||||||
char *newstr;
|
char *newstr;
|
||||||
|
|
||||||
if(!str)
|
if(!str)
|
||||||
return (char *)NULL;
|
return (char *)NULL;
|
||||||
|
|
||||||
len = strlen(str);
|
len = strlen(str);
|
||||||
|
|
||||||
|
if(len >= ((size_t)-1) / sizeof(char))
|
||||||
|
return (char *)NULL;
|
||||||
|
|
||||||
newstr = (char *) malloc((len+1)*sizeof(char));
|
newstr = (char *) malloc((len+1)*sizeof(char));
|
||||||
if(!newstr)
|
if(!newstr)
|
||||||
return (char *)NULL;
|
return (char *)NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user