1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

src/iri.c: Call xstrndup instead of strndup

strndup() does not exist in some older C libraries, also xstrndup()
exits on memory allocation failures.
This commit is contained in:
Tim Rühsen 2014-12-12 16:15:51 +01:00
parent ab2d5d83d2
commit eb0789d43f

View File

@ -41,6 +41,7 @@ as that of the covered work. */
#include "url.h" #include "url.h"
#include "c-strcase.h" #include "c-strcase.h"
#include "c-strcasestr.h" #include "c-strcasestr.h"
#include "xstrndup.h"
/* RFC3987 section 3.1 mandates STD3 ASCII RULES */ /* RFC3987 section 3.1 mandates STD3 ASCII RULES */
#define IDNA_FLAGS IDNA_USE_STD3_ASCII_RULES #define IDNA_FLAGS IDNA_USE_STD3_ASCII_RULES
@ -133,7 +134,7 @@ do_conversion (const char *tocode, const char *fromcode, char *in, size_t inlen,
/* iconv() has to work on an unescaped string */ /* iconv() has to work on an unescaped string */
in_org = in; in_org = in;
in_save = in = strndup(in, inlen); in_save = in = xstrndup(in, inlen);
url_unescape(in); url_unescape(in);
inlen = strlen(in); inlen = strlen(in);