summaryrefslogtreecommitdiff
path: root/acountry.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2009-05-29 13:19:51 +0000
committerYang Tse <yangsita@gmail.com>2009-05-29 13:19:51 +0000
commit16d842958ad756471edb9b022b2a4a5a102e0403 (patch)
tree662f866104edd0ffb05e4efe1691484ee3c5479a /acountry.c
parentef4a786bf636abc8914782c8e6f8ecb4662cedd0 (diff)
downloadc-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.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/acountry.c b/acountry.c
index 1899ae9..69aaeb1 100644
--- a/acountry.c
+++ b/acountry.c
@@ -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);
}