diff options
author | Yang Tse <yangsita@gmail.com> | 2009-05-29 13:19:51 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2009-05-29 13:19:51 +0000 |
commit | 16d842958ad756471edb9b022b2a4a5a102e0403 (patch) | |
tree | 662f866104edd0ffb05e4efe1691484ee3c5479a /acountry.c | |
parent | ef4a786bf636abc8914782c8e6f8ecb4662cedd0 (diff) | |
download | c-ares-16d842958ad756471edb9b022b2a4a5a102e0403.tar.gz c-ares-16d842958ad756471edb9b022b2a4a5a102e0403.tar.bz2 c-ares-16d842958ad756471edb9b022b2a4a5a102e0403.zip |
Fix compiler warning: out of bound access
Diffstat (limited to 'acountry.c')
-rw-r--r-- | acountry.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -612,9 +612,14 @@ static void find_country_from_cname(const char *cname, struct in_addr addr) printf("Name for country-number %d not found.\n", cnumber); else { - if (ver_1 && *(unsigned short*)&country->short_name != *(unsigned*)&ccode_A2) - printf("short-name mismatch; %s vs %s\n", country->short_name, ccode_A2); - + if (ver_1) + { + if ((country->short_name[0] != ccode_A2[0]) || + (country->short_name[1] != ccode_A2[1]) || + (country->short_name[2] != ccode_A2[2])) + printf("short-name mismatch; %s vs %s\n", + country->short_name, ccode_A2); + } printf("%s (%s), number %d.\n", country->long_name, country->short_name, cnumber); } |