From 211c834117971f8aeec1305546d8ed8aa73fbb05 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 9 Mar 2014 16:40:16 +0000 Subject: [PATCH] fixed silly forgotten +1 ... --- c/cmdlineoptions.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/c/cmdlineoptions.c b/c/cmdlineoptions.c index 88aa034..6280b50 100644 --- a/c/cmdlineoptions.c +++ b/c/cmdlineoptions.c @@ -77,7 +77,6 @@ CONode* CmdLO_SearchNode(char* cmdlineargument) { if (node->option->optionscount > 0) { int i = 0; for (; i < node->option->optionscount; ++i) { - //printf("%s %d\n",node->option->options[i], strlen(node->option->options[i])); // debug if (strcmp(node->option->options[i], cmdlineargument) == 0) { return node; @@ -258,8 +257,8 @@ void CmdLO_AddElement(char*** target, unsigned int* counter, char* element) { *target = malloc((cnt + 1) * sizeof(char*)); if (old != 0) memcpy(*target, old, (cnt) * sizeof(char*)); - *(*target + cnt) = malloc(strlen(element) * sizeof(char)); - memcpy(*(*target + cnt), element, strlen(element)); + *(*target + cnt) = malloc((strlen(element) + 1) * sizeof(char)); + memcpy(*(*target + cnt), element, strlen(element) + 1); if (old != 0) free(old); *counter = cnt + 1;