aboutsummaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-02-02 19:46:17 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-02-02 19:46:17 +0100
commit6808d2ac6c1b47ad691284152aa58c95a3983048 (patch)
tree54198d91cae743db68d79e9536768ad821af3bdd /server.c
parenta9db7bcc04530e19223b5037bb8420fa4344b183 (diff)
downloadmig-6808d2ac6c1b47ad691284152aa58c95a3983048.tar.gz
mig-6808d2ac6c1b47ad691284152aa58c95a3983048.tar.bz2
mig-6808d2ac6c1b47ad691284152aa58c95a3983048.zip
Avoid passing NULL to memcpy
Diffstat (limited to 'server.c')
-rw-r--r--server.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/server.c b/server.c
index 3a09aa2..69c3678 100644
--- a/server.c
+++ b/server.c
@@ -994,7 +994,10 @@ WritePackArgValue(FILE *file, const argument_t *arg)
fprintf(file, "\t\tmsgh_simple = FALSE;\n");
fprintf(file, "\t}\n\telse {\n\t");
}
- fprintf(file, "\tmemcpy(OutP->%s, %s, ",
+ fprintf(file, "\tif (%s)\n", count->argVarName);
+ if (it->itIndefinite)
+ fprintf(file, "\t");
+ fprintf(file, "\t\tmemcpy(OutP->%s, %s, ",
arg->argMsgField, arg->argVarName);
if (btype->itTypeSize > 1)
fprintf(file, "%d * ",