summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-11-12 13:42:58 (GMT)
committerKevin Smith <kevin.smith@isode.com>2015-12-17 20:06:10 (GMT)
commit02a5b5c7f263913bd3d9b6977a1c6935e90c97eb (patch)
treec5f3078540ae663d2a7cd379660f2fb8847efb06 /3rdParty/LibIDN/src/stringprep.c
parent6c63910aa1016f06113fd562c8ffebfa6b4241b2 (diff)
downloadswift-02a5b5c7f263913bd3d9b6977a1c6935e90c97eb.zip
swift-02a5b5c7f263913bd3d9b6977a1c6935e90c97eb.tar.bz2
3rdParty fixes to enable compatibility with VS 2015
Included patches for future reference. Test-Information: Tested patches with VS 2015 Community and unit tests for 32 bit and 64 bit builds. Change-Id: Ifa8d0ca3bf33010af8d8094c6df45f2a5702976c
Diffstat (limited to '3rdParty/LibIDN/src/stringprep.c')
-rwxr-xr-x[-rw-r--r--]3rdParty/LibIDN/src/stringprep.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/3rdParty/LibIDN/src/stringprep.c b/3rdParty/LibIDN/src/stringprep.c
index 8ff28e6..19bf0d9 100644..100755
--- a/3rdParty/LibIDN/src/stringprep.c
+++ b/3rdParty/LibIDN/src/stringprep.c
@@ -33,6 +33,7 @@
#include <stdlib.h>
#include <string.h>
+#include <assert.h>
#include "stringprep.h"
@@ -372,7 +373,7 @@ stringprep (char *in,
int rc;
char *utf8 = NULL;
uint32_t *ucs4 = NULL;
- size_t ucs4len, maxucs4len, adducs4len = 50;
+ size_t ucs4len = SIZE_MAX, maxucs4len = SIZE_MAX, adducs4len = 50;
do
{
@@ -380,8 +381,10 @@ stringprep (char *in,
free (ucs4);
ucs4 = stringprep_utf8_to_ucs4 (in, -1, &ucs4len);
- if (ucs4 == NULL)
- return STRINGPREP_ICONV_ERROR;
+ if (ucs4 == NULL) {
+ return STRINGPREP_ICONV_ERROR;
+ }
+ assert(ucs4len != SIZE_MAX);
maxucs4len = ucs4len + adducs4len;
newp = realloc (ucs4, maxucs4len * sizeof (uint32_t));
if (!newp)