From 9ad5ccd66e89778e33cd1be3cd8887ec4a03d177 Mon Sep 17 00:00:00 2001 From: Vadim Kochan Date: Sat, 16 Jul 2016 12:39:43 +0300 Subject: trafgen: ipv4: Do not use user-provided 'ihl' field to calculate csum It is potentially dangerous to use the user specified IHL field for csum calculation, as it might lead to read buffer overflows. Instead introduce and use the len field in struct proto_hdr which is calculated automatically after the header is built. Signed-off-by: Vadim Kochan [tk: reword commit message] Signed-off-by: Tobias Klauser --- trafgen_proto.h | 1 + 1 file changed, 1 insertion(+) (limited to 'trafgen_proto.h') diff --git a/trafgen_proto.h b/trafgen_proto.h index 822d841..72cd9f7 100644 --- a/trafgen_proto.h +++ b/trafgen_proto.h @@ -51,6 +51,7 @@ struct proto_hdr { uint16_t pkt_offset; struct proto_field *fields; size_t fields_count; + size_t len; void (*header_init)(struct proto_hdr *hdr); void (*header_finish)(struct proto_hdr *hdr); -- cgit v1.2.3-54-g00ecf