commit - ab5bda7ecb7748b16898b3af71948dc94ce96296
commit + d1d263eac7f7f573e50efe916ebdb779ced7f247
blob - 479f4639051bdda4d60bc7cf7e8a2684fffb6429
blob + ea73156a5b244c30f54ef2bed294fedfef0ba589
--- 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 - b1ce8d623d39d6ff2faaf210c67f7020e0d4dda5
blob + 5cc80cef226f35b18328aff9d58e25581e26d9e0
--- 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 {