From 962d2fff509e251ae715875e89e5a080a37ab588 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Wed, 14 Apr 2010 13:10:45 -0500 Subject: [PATCH] Fix: Use a union for other address objects --- src/stkutil.c | 2 +- src/stkutil.h | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/stkutil.c b/src/stkutil.c index 3c792ff6..43c06cd2 100644 --- a/src/stkutil.c +++ b/src/stkutil.c @@ -1202,7 +1202,7 @@ static gboolean parse_dataobj_other_address( data = comprehension_tlv_iter_get_data(iter); oa->type = data[0]; - memcpy(oa->addr, data + 1, len - 1); + memcpy(&oa->addr, data + 1, len - 1); return TRUE; } diff --git a/src/stkutil.h b/src/stkutil.h index 08110484..1c05440f 100644 --- a/src/stkutil.h +++ b/src/stkutil.h @@ -562,7 +562,11 @@ struct stk_card_reader_id { * So the maximum size is 16 (for ipv6). */ struct stk_other_address { - unsigned char addr[16]; + union { + /* Network Byte Order */ + unsigned int ipv4; + unsigned char ipv6[16]; + } addr; unsigned char type; };