commit - 1632f50aca5cd94ed681c20fc18c2b8ab4857b9c
commit + 6e0942f6979a3751280659736d0c8252253c6136
blob - b1108c45d826da11c2d77f4d5c684f9c629ea7c8
blob + bde889cb381f5d8e90f44b27a11986e29f2f27d2
--- gotwebd/config.c
+++ gotwebd/config.c
if (srv == NULL)
fatalx("%s: calloc", __func__);
- IMSG_SIZE_CHECK(imsg, srv);
+ if (IMSG_DATA_SIZE(imsg) != sizeof(*srv))
+ fatalx("%s: wrong size", __func__);
memcpy(srv, p, sizeof(*srv));
uint8_t *p = imsg->data;
int i;
- IMSG_SIZE_CHECK(imsg, &sock_conf);
+ if (IMSG_DATA_SIZE(imsg) != sizeof(sock_conf))
+ fatalx("%s: wrong size", __func__);
+
memcpy(&sock_conf, p, sizeof(sock_conf));
if (IMSG_DATA_SIZE(imsg) != sizeof(sock_conf)) {
uint8_t *p = imsg->data;
int sock_id, match = 0, i;
- IMSG_SIZE_CHECK(imsg, &sock_id);
+ if (IMSG_DATA_SIZE(imsg) != sizeof(sock_id))
+ fatalx("%s: wrong size", __func__);
+
memcpy(&sock_id, p, sizeof(sock_id));
TAILQ_FOREACH(sock, &env->sockets, entry) {
blob - 71b34a0258f2a201a28b0745032caf69c7fcd5e6
blob + 8005d4db4e8e1da67b226c26b8e1640b5c42645d
--- gotwebd/gotwebd.h
+++ gotwebd/gotwebd.h
short events;
};
-#define IMSG_SIZE_CHECK(imsg, p) do { \
- if (IMSG_DATA_SIZE(imsg) < sizeof(*p)) \
- fatalx("bad length imsg received (%s)", #p); \
-} while (0)
-
#define IMSG_DATA_SIZE(imsg) ((imsg)->hdr.len - IMSG_HEADER_SIZE)
struct env_val {