laforge submitted this change.
bankd: fix hh_ext pointer arithmetic in worker_transceive_loop()
The pointer to the IPA extension header was calculated as follows:
hh_ext = (struct ipaccess_head_ext *) buf + sizeof(*hh);
Due to the operator precedence, 'buf' is casted first, so the offset
is scaled by sizeof(struct ipaccess_head_ext) rather than being added
in bytes. This happens to work only because that struct is 1 byte
in size. Point hh_ext to the data following the IPA header instead.
No functional change.
Change-Id: Ib3675125b4e30cb2d59c799e68167753bef2358c
---
M src/bankd/bankd_main.c
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bankd/bankd_main.c b/src/bankd/bankd_main.c
index d04b468..70aa9f9 100644
--- a/src/bankd/bankd_main.c
+++ b/src/bankd/bankd_main.c
@@ -1028,7 +1028,7 @@
return 0;
}
- hh_ext = (struct ipaccess_head_ext *) buf + sizeof(*hh);
+ hh_ext = (struct ipaccess_head_ext *) hh->data;
if (data_len < sizeof(*hh_ext)) {
LOGW(worker, "Received short message\n");
return -5;
To view, visit change 44183. To unsubscribe, or for help writing mail filters, visit settings.