Debian Codegraph @

debian/patches/string_t

raw
1 commit 6c4b92f9e9a8ac9f9df3ca1cc5ddb50b4faaaf3f
2 Author: Flavio Cruz <[email protected]>
3 Date: Sun Feb 9 22:38:26 2025 -0500
4
5 Server routines: ensure that strings in the request are null terminated before calling the server routine
6
7 Message-ID: <neoj66xitwcilmtlf3fek6tjal35tuetleyydiduuqvhkjisah@n2a2xwvoqrie>
8
9 diff --git a/server.c b/server.c
10 index 8da231c..9d25573 100644
11 --- a/server.c
12 +++ b/server.c
13 @@ -766,6 +766,14 @@ WriteExtractArg(FILE *file, const argument_t *arg)
14 WriteInitializeCount(file, arg);
15 }
16
17 + /* Ensure strings are null-terminated */
18 + const ipc_type_t *it = arg->argType;
19 + if (akCheck(arg->argKind, akbSend) && it->itString && !it->itVarArray) {
20 + const size_t total_bytes = (it->itSize * it->itNumber)/8;
21 + fprintf(file, "\t/* Ensure %s is null-terminated */\n", arg->argVarName);
22 + fprintf(file, "\t%s[%d] = \'\\0\';\n", InArgMsgField(arg), total_bytes - 1);
23 + }
24 +
25 if (akCheckAll(arg->argKind, akbReturnSnd|akbPointer))
26 WriteInitializePtr(file, arg);
27 if (akCheckAll(arg->argKind, akbSendRcv|akbPointer)) {