# HG changeset patch # User Matti Hamalainen # Date 1455525905 -7200 # Node ID 723a69185102be4287b26516249ac30c89f6b1ec # Parent 81b4688f684b0e45c13524d423f817a861fe4521 Fix th_str{n}dup_trim() functions. diff -r 81b4688f684b -r 723a69185102 th_string.c --- a/th_string.c Mon Feb 15 10:13:08 2016 +0200 +++ b/th_string.c Mon Feb 15 10:45:05 2016 +0200 @@ -74,7 +74,10 @@ end = len; // Allocate memory for result - len = end - start + 1; + len = end - start; + if (len == 0) + return NULL; + if ((res = th_malloc(len + 1)) == NULL) return NULL;