cmdmon: extend initialisation tests

This commit is contained in:
Miroslav Lichvar 2016-01-19 16:53:28 +01:00
parent 0a9d75bfb8
commit 7cc432ff7e

View file

@ -266,7 +266,20 @@ CAM_Initialise(int family)
command_length = PKL_CommandLength(&r); command_length = PKL_CommandLength(&r);
padding_length = PKL_CommandPaddingLength(&r); padding_length = PKL_CommandPaddingLength(&r);
assert(padding_length <= MAX_PADDING_LENGTH && padding_length <= command_length); assert(padding_length <= MAX_PADDING_LENGTH && padding_length <= command_length);
assert(command_length == 0 || command_length >= offsetof(CMD_Reply, data)); assert((command_length >= offsetof(CMD_Request, data) &&
command_length <= sizeof (CMD_Request)) || command_length == 0);
}
for (i = 1; i < N_REPLY_TYPES; i++) {
CMD_Reply r;
int reply_length;
r.reply = htons(i);
r.status = STT_SUCCESS;
r.data.manual_list.n_samples = htonl(MAX_MANUAL_LIST_SAMPLES);
reply_length = PKL_ReplyLength(&r);
assert((reply_length >= offsetof(CMD_Reply, data) &&
reply_length <= sizeof (CMD_Reply)) || reply_length == 0);
} }
sock_fdu = -1; sock_fdu = -1;