diff options
author | harbaum <> | 2006-01-28 15:36:18 +0000 |
---|---|---|
committer | harbaum <> | 2006-01-28 15:36:18 +0000 |
commit | 0a50da0d92193cfbd2a555f5bc57ebc87eaae451 (patch) | |
tree | 063d68e6e836e3efad6bcd67326f998828562829 /evaluator.c | |
parent | 5f453b161a0cb67b7cf507e28349c7257a477063 (diff) | |
download | lcd4linux-0a50da0d92193cfbd2a555f5bc57ebc87eaae451.tar.gz |
[lcd4linux @ 2006-01-28 15:36:17 by harbaum]
Fix: string termination bug in eval()
Diffstat (limited to 'evaluator.c')
-rw-r--r-- | evaluator.c | 10 |
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; |