[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 2135819 1/5: Fix memory size allocation in src
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 2135819 1/5: Fix memory size allocation in src/header/ui.c |
Date: |
Wed, 27 Jul 2016 12:41:08 +0000 (UTC) |
branch: master
commit 2135819bbd1dd30d15d27a4a4fd63424c8f1a397
Author: Vladimir Markelov <address@hidden>
Commit: Vladimir Markelov <address@hidden>
Fix memory size allocation in src/header/ui.c
Allocated for a new string memory should be long enough to store the
original data and ending '\0' character. The patch increases allocated
memory size by one character for the end-of-string character.
This fixed the bug #48642
---
src/header/ui.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/header/ui.c b/src/header/ui.c
index 7be6042..67ccf73 100644
--- a/src/header/ui.c
+++ b/src/header/ui.c
@@ -243,7 +243,7 @@ setuprename(struct headerparams *p)
/* `c' is created in case of an error, so the input value can be
reported. */
errno=0;
- c=malloc(strlen(tmp->v));
+ c=malloc(strlen(tmp->v) + 1);
if(c==NULL) error(EXIT_FAILURE, errno, "space for c in setuprename");
strcpy(c, tmp->v);