From: douniwan5788 <douniwan5788@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Date: Tue, 5 Feb 2013 17:27:21 +0000 (+0000)
Subject: fixed cmd malloc strlen()+1 bug
X-Git-Tag: v1.0.0~131
X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/8ca5586d49825e3a01b7ec58d8ade4d64564d244

fixed cmd malloc strlen()+1 bug
---

diff --git a/client/proxmark3.c b/client/proxmark3.c
index 4b898d54..96f900c7 100644
--- a/client/proxmark3.c
+++ b/client/proxmark3.c
@@ -91,7 +91,7 @@ static void *main_loop(void *targ)
                     nl = strrchr(script_cmd_buf, '\n');
                     if (nl) *nl = '\0';
 	            
-                    if ((cmd = (char*) malloc(strlen(script_cmd_buf))) != NULL)
+                    if ((cmd = (char*) malloc(strlen(script_cmd_buf) + 1)) != NULL)
                     {
                         memset(cmd, 0, strlen(script_cmd_buf));
                         strcpy(cmd, script_cmd_buf);