aboutsummaryrefslogtreecommitdiffstats
path: root/evaluator.c
diff options
context:
space:
mode:
authorharbaum <harbaum@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2006-01-28 15:36:18 +0000
committerharbaum <harbaum@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2006-01-28 15:36:18 +0000
commit5eca256613eb7e4fb476d5efa71a835af5bb5d06 (patch)
tree063d68e6e836e3efad6bcd67326f998828562829 /evaluator.c
parent4320569c3151d039151a3ea8f37fcee77d67d96a (diff)
downloadlcd4linux-5eca256613eb7e4fb476d5efa71a835af5bb5d06.tar.gz
[lcd4linux @ 2006-01-28 15:36:17 by harbaum]
Fix: string termination bug in eval() git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@625 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'evaluator.c')
-rw-r--r--evaluator.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/evaluator.c b/evaluator.c
index e4493b3..d4b4671 100644
--- a/evaluator.c
+++ b/evaluator.c
@@ -1,4 +1,4 @@
-/* $Id: evaluator.c,v 1.26 2006/01/21 09:40:20 reinelt Exp $
+/* $Id: evaluator.c,v 1.27 2006/01/28 15:36:18 harbaum Exp $
*
* expression evaluation
*
@@ -23,6 +23,9 @@
*
*
* $Log: evaluator.c,v $
+ * Revision 1.27 2006/01/28 15:36:18 harbaum
+ * Fix: string termination bug in eval()
+ *
* Revision 1.26 2006/01/21 09:40:20 reinelt
* Big Memory Leak in Evaluator fixed (thanks to Oliver Gehrke)
*
@@ -1306,9 +1309,10 @@ int Eval(void *tree, RESULT * result)
result->length = Tree->Result->length;
if (result->length >= 0) {
result->string = malloc(result->length+1);
- if (Tree->Result->string != NULL)
+ if (Tree->Result->string != NULL) {
strncpy(result->string, Tree->Result->string, result->length);
- else
+ result->string[result->length] = 0;
+ } else
result->string[0] = '\0';
} else {
result->string = NULL;