diff options
authorPhilipp Maier <pmaier@sysmocom.de>2018-05-28 17:50:09 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2018-05-28 17:50:09 +0200
commit6a2856bab55b00cb56fe057cb55e0ecf0b705471 (patch)
parent0d95ca59f98defc38475442d220618212813994a (diff)
ggsn: make sure ipcp_option_hdr and and ipcp_hdr are packed
struct ipcp_option_hdr and struct ipcp_hdr are not declared as packed explicitly, but they are used to parse memory blobs by casting pointers. Add __attribute__((packed)) to ensure that those structs are stored packed. Change-Id: I14e10bb3ce482347b3f0c4d3a75168a55df15f20 Related: OS#3288
1 files changed, 2 insertions, 2 deletions
diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index 3a8c4be..14bf04f 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -403,14 +403,14 @@ struct ipcp_option_hdr {
uint8_t type;
uint8_t len;
uint8_t data[0];
+} __attribute__ ((packed));
struct ipcp_hdr {
uint8_t code;
uint8_t id;
uint16_t len;
uint8_t options[0];
+} __attribute__ ((packed));
/* determine if IPCP contains given option */
static struct ipcp_option_hdr *ipcp_contains_option(struct ipcp_hdr *ipcp, enum ipcp_options opt)