summaryrefslogtreecommitdiff
path: root/user.c
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-02-21 21:44:15 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-02-21 21:44:15 +0100
commitbb06f65290c2526d214302ba43bb6bc363cd4868 (patch)
treee7d7ac50f27837a2ffdc874d3e9cb3fe3bd93481 /user.c
parent5e3ef5153fe6aa2190ffa185009fa45e3549469d (diff)
Fix variable-sized c strings
Previously, the terminating zero of variable-sized c strings was only included when copying the message if the length of the string was not a multiple of four. mig_strncpy returns the length of the string excluding the terminating zero. Fix this by properly accounting for the byte for the terminating zero in the array length. * server.c (WritePackArgValue): Account for the terminating zero in the array length. * user.c (WritePackArgValue): Likewise.
Diffstat (limited to 'user.c')
-rw-r--r--user.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/user.c b/user.c
index 37f53d2..f4a6cd5 100644
--- a/user.c
+++ b/user.c
@@ -411,6 +411,11 @@ WritePackArgValue(FILE *file, const argument_t *arg)
arg->argMsgField,
arg->argVarName,
it->itNumber);
+ fprintf(file,
+ "\tif (InP->%s < %d) InP->%s += 1;\n",
+ arg->argCount->argMsgField,
+ it->itNumber,
+ arg->argCount->argMsgField);
}
else {