Hello community,

here is the log from the commit of package GeoIP for openSUSE:Factory checked 
in at 2015-03-09 10:09:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/GeoIP (Old)
 and      /work/SRC/openSUSE:Factory/.GeoIP.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "GeoIP"

Changes:
--------
--- /work/SRC/openSUSE:Factory/GeoIP/GeoIP.changes      2015-02-24 
13:06:43.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.GeoIP.new/GeoIP.changes 2015-03-09 
10:10:02.000000000 +0100
@@ -1,0 +2,14 @@
+Fri Mar  6 18:40:37 UTC 2015 - mplus...@suse.com
+
+- Update to 1.6.5
+  * A segmentation fault in geoiplookup was fixed when the utility 
+    was passed an invalid database. (Reported in Red Hat 
+    bug #1180874.)
+  * Additional validation was added for validation of the size used 
+    in the creation of the index cache. (Based on discussion in 
+    Red Hat bug #832913.)
+  * Changed the code to only look up country codes by using 
+    functions which ensure that we do not try to look past the end 
+    of an array. (Reported by Ivan Sorokin. GitHub #53)
+
+-------------------------------------------------------------------

Old:
----
  GeoIP-1.6.4.tar.gz

New:
----
  GeoIP-1.6.5.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ GeoIP.spec ++++++
--- /var/tmp/diff_new_pack.55uQPA/_old  2015-03-09 10:10:03.000000000 +0100
+++ /var/tmp/diff_new_pack.55uQPA/_new  2015-03-09 10:10:03.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           GeoIP
-Version:        1.6.4
+Version:        1.6.5
 Release:        0
 Summary:        Library to find the country that any IP address originates from
 License:        GPL-2.0+ and LGPL-2.1+ and CC-BY-SA-3.0

++++++ GeoIP-1.6.4.tar.gz -> GeoIP-1.6.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/GeoIP-1.6.4/ChangeLog new/GeoIP-1.6.5/ChangeLog
--- old/GeoIP-1.6.4/ChangeLog   2015-01-12 22:45:58.000000000 +0100
+++ new/GeoIP-1.6.5/ChangeLog   2015-02-25 23:29:48.000000000 +0100
@@ -1,3 +1,14 @@
+1.6.5 2015-02-25
+
+* A segmentation fault in `geoiplookup` was fixed when the utility was passed
+  an invalid database. (Reported in Red Hat bug #1180874.)
+* Additional validation was added for validation of the size used in the
+  creation of the index cache. (Based on discussion in Red Hat bug #832913.)
+* Changed the code to only look up country codes by using functions which
+  ensure that we do not try to look past the end of an array. (Reported by
+  Ivan Sorokin. GitHub #53)
+
+
 1.6.4 2015-01-12
 
 * Update Fips codes (Boris Zentner)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/GeoIP-1.6.4/GeoIP.spec new/GeoIP-1.6.5/GeoIP.spec
--- old/GeoIP-1.6.4/GeoIP.spec  2015-01-12 22:46:59.000000000 +0100
+++ new/GeoIP-1.6.5/GeoIP.spec  2015-02-25 23:31:31.000000000 +0100
@@ -1,5 +1,5 @@
 Name:      GeoIP
-Version:    1.6.4
+Version:    1.6.5
 Summary:    GeoIP is a C library finds the location of an IP address.
 Release:    1
 Group:     System Environment/Libraries
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/GeoIP-1.6.4/apps/geoiplookup.c 
new/GeoIP-1.6.5/apps/geoiplookup.c
--- old/GeoIP-1.6.4/apps/geoiplookup.c  2014-11-11 20:59:10.000000000 +0100
+++ new/GeoIP-1.6.5/apps/geoiplookup.c  2015-02-25 23:28:41.000000000 +0100
@@ -144,8 +144,7 @@
     return p ? p : "N/A";
 }
 
-static unsigned long
-__addr_to_num(const char *addr)
+static unsigned long __addr_to_num(const char *addr)
 {
     unsigned int c, octet, t;
     unsigned long ipnum;
@@ -245,8 +244,7 @@
     GeoIP_range_by_ip_delete(range);
 }
 
-void
-geoiplookup(GeoIP * gi, char *hostname, int i)
+void geoiplookup(GeoIP * gi, char *hostname, int i)
 {
     const char *country_code;
     const char *country_name;
@@ -263,9 +261,7 @@
     if (ipnum == 0) {
         printf("%s: can't resolve hostname ( %s )\n", GeoIPDBDescription[i],
                hostname);
-
     }else {
-
         if (GEOIP_DOMAIN_EDITION == i) {
             domain_name = GeoIP_name_by_ipnum(gi, ipnum);
             if (domain_name == NULL) {
@@ -294,6 +290,10 @@
             }
         }else if (GEOIP_COUNTRY_EDITION == i) {
             country_id = GeoIP_id_by_ipnum(gi, ipnum);
+            if (country_id < 0 || country_id >= (int) GeoIP_num_countries()) {
+                printf("%s: Invalid database\n", GeoIPDBDescription[i]);
+                return;
+            }
             country_code = GeoIP_country_code[country_id];
             country_name = GeoIP_country_name[country_id];
             if (country_id == 0) {
@@ -370,18 +370,6 @@
                 printf("%s: Corporate\n", GeoIPDBDescription[i]);
             }
             _say_range_by_ip(gi, ipnum);
-        }else {
-
-            /*
-             * Silent ignore IPv6 databases. Otherwise we get annoying
-             * messages whenever we have a mixed environment IPv4 and
-             *  IPv6
-             */
-
-            /*
-             * printf("Can not handle database type -- try geoiplookup6\n");
-             */
-            ;
         }
     }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/GeoIP-1.6.4/apps/geoiplookup6.c 
new/GeoIP-1.6.5/apps/geoiplookup6.c
--- old/GeoIP-1.6.4/apps/geoiplookup6.c 2014-09-03 21:09:18.000000000 +0200
+++ new/GeoIP-1.6.5/apps/geoiplookup6.c 2015-02-25 23:28:41.000000000 +0100
@@ -139,23 +139,7 @@
     if (__GEOIP_V6_IS_NULL(ipnum)) {
         printf("%s: can't resolve hostname ( %s )\n", GeoIPDBDescription[i],
                hostname);
-
     }else {
-
-
-#if 0
-        if (GEOIP_DOMAIN_EDITION_V6 == i) {
-            domain_name = GeoIP_name_by_name_v6(gi, hostname);
-            if (domain_name == NULL) {
-                printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
-            }else {
-                printf("%s: %s\n", GeoIPDBDescription[i], domain_name);
-            }
-        }
-#endif
-
-
-
         if (GEOIP_LOCATIONA_EDITION_V6 == i || GEOIP_ASNUM_EDITION_V6 == i ||
             GEOIP_USERTYPE_EDITION_V6 == i || GEOIP_REGISTRAR_EDITION_V6 ==
             i ||
@@ -192,8 +176,11 @@
                        gir->area_code);
             }
         }else if (GEOIP_COUNTRY_EDITION_V6 == i) {
-
             country_id = GeoIP_id_by_ipnum_v6(gi, ipnum);
+            if (country_id < 0 || country_id >= (int) GeoIP_num_countries()) {
+                printf("%s: Invalid database\n", GeoIPDBDescription[i]);
+                return;
+            }
             country_code = GeoIP_country_code[country_id];
             country_name = GeoIP_country_name[country_id];
             if (country_id == 0) {
@@ -204,61 +191,4 @@
             }
         }
     }
-
-#if 0
-
-    else
-    if (GEOIP_REGION_EDITION_REV0 == i || GEOIP_REGION_EDITION_REV1 == i) {
-        region = GeoIP_region_by_name_v6(gi, hostname);
-        if (NULL == region) {
-            printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
-        }else {
-            printf("%s: %s, %s\n", GeoIPDBDescription[i], region->country_code,
-                   region->region);
-            GeoIPRegion_delete(region);
-        }
-    }else if (GEOIP_CITY_EDITION_REV0 == i) {
-        gir = GeoIP_record_by_name(gi, hostname);
-        if (NULL == gir) {
-            printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
-        }else {
-            printf("%s: %s, %s, %s, %s, %f, %f\n", GeoIPDBDescription[i],
-                   gir->country_code, gir->region,
-                   gir->city, gir->postal_code, gir->latitude,
-                   gir->longitude);
-        }
-    }else if (GEOIP_CITY_EDITION_REV1 == i) {
-        gir = GeoIP_record_by_name(gi, hostname);
-        if (NULL == gir) {
-            printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
-        }else {
-            printf("%s: %s, %s, %s, %s, %f, %f, %d, %d\n",
-                   GeoIPDBDescription[i], gir->country_code, gir->region,
-                   gir->city,
-                   gir->postal_code,
-                   gir->latitude, gir->longitude, gir->metro_code,
-                   gir->area_code);
-        }
-    }else if (GEOIP_ORG_EDITION == i || GEOIP_ISP_EDITION == i) {
-        org = GeoIP_org_by_name_v6(gi, hostname);
-        if (org == NULL) {
-            printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
-        }else {
-            printf("%s: %s\n", GeoIPDBDescription[i], org);
-        }
-    }else if (GEOIP_NETSPEED_EDITION == i) {
-        netspeed = GeoIP_id_by_name_v6(gi, hostname);
-        if (netspeed == GEOIP_UNKNOWN_SPEED) {
-            printf("%s: Unknown\n", GeoIPDBDescription[i]);
-        }else if (netspeed == GEOIP_DIALUP_SPEED) {
-            printf("%s: Dialup\n", GeoIPDBDescription[i]);
-        }else if (netspeed == GEOIP_CABLEDSL_SPEED) {
-            printf("%s: Cable/DSL\n", GeoIPDBDescription[i]);
-        }else if (netspeed == GEOIP_CORPORATE_SPEED) {
-            printf("%s: Corporate\n", GeoIPDBDescription[i]);
-        }
-
-    }
-#endif
-
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/GeoIP-1.6.4/configure new/GeoIP-1.6.5/configure
--- old/GeoIP-1.6.4/configure   2015-01-12 22:46:41.000000000 +0100
+++ new/GeoIP-1.6.5/configure   2015-02-25 23:31:06.000000000 +0100
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for GeoIP 1.6.4.
+# Generated by GNU Autoconf 2.69 for GeoIP 1.6.5.
 #
 # Report bugs to <supp...@maxmind.com>.
 #
@@ -590,8 +590,8 @@
 # Identity of this package.
 PACKAGE_NAME='GeoIP'
 PACKAGE_TARNAME='GeoIP'
-PACKAGE_VERSION='1.6.4'
-PACKAGE_STRING='GeoIP 1.6.4'
+PACKAGE_VERSION='1.6.5'
+PACKAGE_STRING='GeoIP 1.6.5'
 PACKAGE_BUGREPORT='supp...@maxmind.com'
 PACKAGE_URL=''
 
@@ -1314,7 +1314,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures GeoIP 1.6.4 to adapt to many kinds of systems.
+\`configure' configures GeoIP 1.6.5 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1384,7 +1384,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of GeoIP 1.6.4:";;
+     short | recursive ) echo "Configuration of GeoIP 1.6.5:";;
    esac
   cat <<\_ACEOF
 
@@ -1490,7 +1490,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-GeoIP configure 1.6.4
+GeoIP configure 1.6.5
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1967,7 +1967,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by GeoIP $as_me 1.6.4, which was
+It was created by GeoIP $as_me 1.6.5, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2835,7 +2835,7 @@
 
 # Define the identity of the package.
  PACKAGE='GeoIP'
- VERSION='1.6.4'
+ VERSION='1.6.5'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -13726,7 +13726,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by GeoIP $as_me 1.6.4, which was
+This file was extended by GeoIP $as_me 1.6.5, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -13783,7 +13783,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-GeoIP config.status 1.6.4
+GeoIP config.status 1.6.5
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/GeoIP-1.6.4/configure.ac new/GeoIP-1.6.5/configure.ac
--- old/GeoIP-1.6.4/configure.ac        2015-01-12 22:45:46.000000000 +0100
+++ new/GeoIP-1.6.5/configure.ac        2015-02-25 23:30:14.000000000 +0100
@@ -1,7 +1,7 @@
 dnl AM_CONFIG_HEADER(config.h)
 
 AC_PREREQ([2.65])
-AC_INIT([GeoIP], [1.6.4],[supp...@maxmind.com],[GeoIP])
+AC_INIT([GeoIP], [1.6.5],[supp...@maxmind.com],[GeoIP])
 AC_CONFIG_AUX_DIR([.])
 AC_CONFIG_SRCDIR([libGeoIP/GeoIP.c])
 AC_CONFIG_MACRO_DIR([m4])
Files old/GeoIP-1.6.4/data/GeoIP.dat and new/GeoIP-1.6.5/data/GeoIP.dat differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/GeoIP-1.6.4/libGeoIP/GeoIP.c 
new/GeoIP-1.6.5/libGeoIP/GeoIP.c
--- old/GeoIP-1.6.4/libGeoIP/GeoIP.c    2015-01-08 22:12:06.000000000 +0100
+++ new/GeoIP-1.6.5/libGeoIP/GeoIP.c    2015-02-25 23:28:41.000000000 +0100
@@ -629,10 +629,8 @@
 {
     return inet_ntop(af, src, dst, cnt);
 }
-
 #endif /* defined(_WIN32) */
 
-
 int __GEOIP_V6_IS_NULL(geoipv6_t v6)
 {
     int i;
@@ -918,8 +916,34 @@
             && database_type != GEOIP_REGION_EDITION_REV1) ? 1 : 0;
 }
 
-static
-void _setup_segments(GeoIP * gi)
+
+static ssize_t get_index_size(GeoIP * gi, struct stat *buf)
+{
+    ssize_t index_size;
+    unsigned int segment;
+
+    if (!_database_has_content(gi->databaseType)) {
+        return buf->st_size;
+    }
+
+    segment = gi->databaseSegments[0];
+    index_size = segment * (ssize_t)gi->record_length * 2;
+
+    /* check for overflow in multiplication */
+    if (segment != 0
+        && index_size / segment != (ssize_t)gi->record_length * 2) {
+        return -1;
+    }
+
+    /* Index size should never exceed the size of the file */
+    if (index_size > buf->st_size) {
+        return -1;
+    }
+
+    return index_size;
+}
+
+static void _setup_segments(GeoIP * gi)
 {
     int i, j, segment_record_length;
     unsigned char delim[3];
@@ -1039,7 +1063,7 @@
 int _check_mtime(GeoIP *gi)
 {
     struct stat buf;
-    unsigned int idx_size;
+    ssize_t idx_size;
 
 #if !defined(_WIN32)
     struct timeval t;
@@ -1153,15 +1177,8 @@
                     return -1;
                 }
 
-                /* make sure the index is <= file size
-                 * This test makes sense for all modes - not
-                 * only index
-                 */
-                idx_size =
-                    _database_has_content(gi->databaseType) ? gi->
-                    databaseSegments[0
-                    ] * (long)gi->record_length * 2 :  buf.st_size;
-                if (idx_size > buf.st_size) {
+                idx_size = get_index_size(gi, &buf);
+                if (idx_size < 0) {
                     DEBUG_MSGF(gi->flags, "Error file %s -- corrupt\n",
                                gi->file_path);
                     return -1;
@@ -1172,10 +1189,11 @@
                         gi->index_cache, sizeof(unsigned char) * idx_size );
                     if (gi->index_cache != NULL) {
                         if (pread(fileno(gi->GeoIPDatabase), gi->index_cache,
-                                  idx_size, 0 ) != (ssize_t)idx_size) {
-                            DEBUG_MSGF(gi->flags,
-                                       "Error reading file %s where 
reloading\n",
-                                       gi->file_path);
+                                  idx_size, 0 ) != idx_size) {
+                            DEBUG_MSGF(
+                                gi->flags,
+                                "Error reading file %s where reloading\n",
+                                gi->file_path);
                             return -1;
                         }
                     }
@@ -1264,9 +1282,10 @@
 
     /* shouldn't reach here */
     _GeoIP_inet_ntop(AF_INET6, &ipnum.s6_addr[0], paddr, ADDR_STR_LEN);
-    DEBUG_MSGF(gi->flags,
-               "Error Traversing Database for ipnum = %s - Perhaps database is 
corrupt?\n",
-               paddr);
+    DEBUG_MSGF(
+        gi->flags,
+        "Error Traversing Database for ipnum = %s - Perhaps database is 
corrupt?\n",
+        paddr);
     return 0;
 }
 
@@ -1352,9 +1371,10 @@
         offset = x;
     }
     /* shouldn't reach here */
-    DEBUG_MSGF(gi->flags,
-               "Error Traversing Database for ipnum = %lu - Perhaps database 
is corrupt?\n",
-               ipnum);
+    DEBUG_MSGF(
+        gi->flags,
+        "Error Traversing Database for ipnum = %lu - Perhaps database is 
corrupt?\n",
+        ipnum);
     return 0;
 }
 
@@ -1442,7 +1462,7 @@
 GeoIP * GeoIP_open(const char * filename, int flags)
 {
     struct stat buf;
-    unsigned int idx_size;
+    ssize_t idx_size;
     GeoIP * gi;
     size_t len;
 
@@ -1520,12 +1540,9 @@
     gi->ext_flags = 1U << GEOIP_TEREDO_BIT;
     _setup_segments(gi);
 
-    idx_size =
-        _database_has_content(gi->databaseType) ? gi->databaseSegments[0] *
-        (long)gi->record_length * 2 :  buf.st_size;
+    idx_size = get_index_size(gi, &buf);
 
-    /* make sure the index is <= file size */
-    if (idx_size > buf.st_size) {
+    if (idx_size < 0) {
         DEBUG_MSGF(gi->flags, "Error file %s -- corrupt\n", gi->file_path);
         if (flags & GEOIP_MEMORY_CACHE) {
             free(gi->cache);
@@ -1598,7 +1615,7 @@
 {
     int country_id;
     country_id = GeoIP_id_by_name_v6_gl(gi, name, gl);
-    return (country_id > 0) ? GeoIP_country_code[country_id] : NULL;
+    return (country_id > 0) ? GeoIP_code_by_id(country_id) : NULL;
 }
 
 const char *GeoIP_country_code_by_name_gl(GeoIP * gi, const char *name,
@@ -1606,7 +1623,7 @@
 {
     int country_id;
     country_id = GeoIP_id_by_name_gl(gi, name, gl);
-    return (country_id > 0) ? GeoIP_country_code[country_id] : NULL;
+    return (country_id > 0) ? GeoIP_code_by_id(country_id) : NULL;
 }
 
 const char *GeoIP_country_code3_by_name_v6_gl(GeoIP * gi, const char *name,
@@ -1614,7 +1631,7 @@
 {
     int country_id;
     country_id = GeoIP_id_by_name_v6_gl(gi, name, gl);
-    return (country_id > 0) ? GeoIP_country_code3[country_id] : NULL;
+    return (country_id > 0) ? GeoIP_code3_by_id(country_id) : NULL;
 }
 
 const char *GeoIP_country_code3_by_name_gl(GeoIP * gi, const char *name,
@@ -1622,7 +1639,7 @@
 {
     int country_id;
     country_id = GeoIP_id_by_name_gl(gi, name, gl);
-    return (country_id > 0) ? GeoIP_country_code3[country_id] : NULL;
+    return (country_id > 0) ? GeoIP_code3_by_id(country_id) : NULL;
 }
 
 const char *GeoIP_country_name_by_name_v6_gl(GeoIP * gi, const char *name,
@@ -1769,7 +1786,7 @@
 {
     int country_id;
     country_id = GeoIP_id_by_addr_v6_gl(gi, addr, gl);
-    return (country_id > 0) ? GeoIP_country_code[country_id] : NULL;
+    return (country_id > 0) ? GeoIP_code_by_id(country_id) : NULL;
 }
 
 
@@ -1778,14 +1795,14 @@
 {
     int country_id;
     country_id = GeoIP_id_by_addr_gl(gi, addr, gl);
-    return (country_id > 0) ? GeoIP_country_code[country_id] : NULL;
+    return (country_id > 0) ? GeoIP_code_by_id(country_id) : NULL;
 }
 const char *GeoIP_country_code3_by_addr_v6_gl(GeoIP * gi, const char *addr,
                                               GeoIPLookup * gl)
 {
     int country_id;
     country_id = GeoIP_id_by_addr_v6_gl(gi, addr, gl);
-    return (country_id > 0) ? GeoIP_country_code3[country_id] : NULL;
+    return (country_id > 0) ? GeoIP_code3_by_id(country_id) : NULL;
 }
 
 const char *GeoIP_country_code3_by_addr_gl(GeoIP * gi, const char *addr,
@@ -1793,7 +1810,7 @@
 {
     int country_id;
     country_id = GeoIP_id_by_addr_gl(gi, addr, gl);
-    return (country_id > 0) ? GeoIP_country_code3[country_id] : NULL;
+    return (country_id > 0) ? GeoIP_code3_by_id(country_id) : NULL;
 }
 
 const char *GeoIP_country_name_by_addr_v6_gl(GeoIP * gi, const char *addr,
@@ -1833,7 +1850,7 @@
 {
     int country_id;
     country_id = GeoIP_id_by_ipnum_gl(gi, ipnum, gl);
-    return (country_id > 0) ? GeoIP_country_code[country_id] : NULL;
+    return (country_id > 0) ? GeoIP_code_by_id(country_id) : NULL;
 }
 
 const char *GeoIP_country_code_by_ipnum_v6_gl(GeoIP * gi, geoipv6_t ipnum,
@@ -1841,7 +1858,7 @@
 {
     int country_id;
     country_id = GeoIP_id_by_ipnum_v6_gl(gi, ipnum, gl);
-    return (country_id > 0) ? GeoIP_country_code[country_id] : NULL;
+    return (country_id > 0) ? GeoIP_code_by_id(country_id) : NULL;
 }
 
 const char *GeoIP_country_code3_by_ipnum_gl(GeoIP * gi, unsigned long ipnum,
@@ -1849,7 +1866,7 @@
 {
     int country_id;
     country_id = GeoIP_id_by_ipnum_gl(gi, ipnum, gl);
-    return (country_id > 0) ? GeoIP_country_code3[country_id] : NULL;
+    return (country_id > 0) ? GeoIP_code3_by_id(country_id) : NULL;
 }
 
 const char *GeoIP_country_code3_by_ipnum_v6_gl(GeoIP * gi, geoipv6_t ipnum,
@@ -1857,14 +1874,13 @@
 {
     int country_id;
     country_id = GeoIP_id_by_ipnum_v6_gl(gi, ipnum, gl);
-    return (country_id > 0) ? GeoIP_country_code3[country_id] : NULL;
+    return (country_id > 0) ? GeoIP_code3_by_id(country_id) : NULL;
 }
 
 int GeoIP_country_id_by_addr_v6_gl(GeoIP * gi, const char *addr,
                                    GeoIPLookup * gl)
 {
-    GeoIPLookup n;
-    return GeoIP_id_by_addr_v6_gl(gi, addr, &n);
+    return GeoIP_id_by_addr_v6_gl(gi, addr, gl);
 }
 
 int GeoIP_country_id_by_addr_gl(GeoIP * gi, const char *addr, GeoIPLookup * gl)
@@ -2040,7 +2056,10 @@
             region->region[0] = (char)((seek_region - 1000) / 26 + 65);
             region->region[1] = (char)((seek_region - 1000) % 26 + 65);
         } else {
-            memcpy(region->country_code, GeoIP_country_code[seek_region], 2);
+            const char *code = GeoIP_code_by_id(seek_region);
+            if (code != NULL) {
+                memcpy(region->country_code, code, 2);
+            }
         }
     } else if (gi->databaseType == GEOIP_REGION_EDITION_REV1) {
         /* Region Edition, post June 2003 */
@@ -2061,12 +2080,13 @@
             region->region[0] = (char)((seek_region - CANADA_OFFSET) / 26 + 
65);
             region->region[1] = (char)((seek_region - CANADA_OFFSET) % 26 + 
65);
         } else {
-            /* Not US or Canada ( world countries country code is always cc_id 
* 360 ) */
-            /* coverity[dont_call] */
-            memcpy(
-                region->country_code,
-                GeoIP_country_code[(seek_region -
-                                    WORLD_OFFSET) / FIPS_RANGE], 2);
+            /* Not US or Canada ( cc_id is always cc_id * FIPS_RANGE ) */
+            const char *code = GeoIP_code_by_id(
+                (seek_region - WORLD_OFFSET) / FIPS_RANGE);
+            if (code != NULL) {
+                /* coverity[dont_call] */
+                memcpy(region->country_code, code, 2);
+            }
         }
     }
 }
@@ -2092,8 +2112,11 @@
             region->region[0] = (char)((seek_region - 1000) / 26 + 65);
             region->region[1] = (char)((seek_region - 1000) % 26 + 65);
         } else {
-            /* coverity[dont_call] */
-            memcpy(region->country_code, GeoIP_country_code[seek_region], 2);
+            const char *code = GeoIP_code_by_id(seek_region);
+            if (code != NULL) {
+                /* coverity[dont_call] */
+                memcpy(region->country_code, code, 2);
+            }
         }
     } else if (gi->databaseType == GEOIP_REGION_EDITION_REV1) {
         /* Region Edition, post June 2003 */
@@ -2115,11 +2138,12 @@
             region->region[1] = (char)((seek_region - CANADA_OFFSET) % 26 + 
65);
         } else {
             /* Not US or Canada ( cc_id is always cc_id * FIPS_RANGE ) */
-            /* coverity[dont_call] */
-            memcpy(
-                region->country_code,
-                GeoIP_country_code[(seek_region -
-                                    WORLD_OFFSET) / FIPS_RANGE], 2);
+            const char *code = GeoIP_code_by_id(
+                (seek_region - WORLD_OFFSET) / FIPS_RANGE);
+            if (code != NULL) {
+                /* coverity[dont_call] */
+                memcpy(region->country_code, code, 2);
+            }
         }
     }
 }
@@ -2261,7 +2285,7 @@
 static
 char *_get_name_gl(GeoIP * gi, unsigned long ipnum, GeoIPLookup * gl)
 {
-    int seek_org;
+    unsigned int seek_org;
     char buf[MAX_ORG_RECORD_LENGTH];
     char * org_buf, * buf_pointer;
     int record_pointer;
@@ -2323,7 +2347,7 @@
 static
 char *_get_name_v6_gl(GeoIP * gi, geoipv6_t ipnum, GeoIPLookup * gl)
 {
-    int seek_org;
+    unsigned int seek_org;
     char buf[MAX_ORG_RECORD_LENGTH + 1];
     char * org_buf, * buf_pointer;
     int record_pointer;
@@ -2415,7 +2439,7 @@
     unsigned long right_seek;
     unsigned long mask;
     int orig_netmask;
-    int target_value;
+    unsigned int target_value;
     char **ret;
     GeoIPLookup t;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/GeoIP-1.6.4/libGeoIP/GeoIP.h 
new/GeoIP-1.6.5/libGeoIP/GeoIP.h
--- old/GeoIP-1.6.4/libGeoIP/GeoIP.h    2015-01-08 22:12:06.000000000 +0100
+++ new/GeoIP-1.6.5/libGeoIP/GeoIP.h    2015-02-25 23:28:41.000000000 +0100
@@ -36,7 +36,7 @@
 #define snprintf _snprintf
 #define FILETIME_TO_USEC(ft)                      \
     (((unsigned __int64)ft.dwHighDateTime << 32 | \
-        ft.dwLowDateTime) / 10)
+      ft.dwLowDateTime) / 10)
 #endif /* !defined(_WIN32) */
 
 #include <stdio.h>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/GeoIP-1.6.4/libGeoIP/pread.c 
new/GeoIP-1.6.5/libGeoIP/pread.c
--- old/GeoIP-1.6.4/libGeoIP/pread.c    2015-01-08 22:12:06.000000000 +0100
+++ new/GeoIP-1.6.5/libGeoIP/pread.c    2015-02-25 23:28:41.000000000 +0100
@@ -28,15 +28,15 @@
 
 #pragma section(".CRT$XCU",read)
 
-#define INITIALIZER(f)                                                         
\
-    static void __cdecl f(void);                                               
\
-    __declspec(allocate(".CRT$XCU")) void (__cdecl*f##_)(void) = f;            
\
+#define INITIALIZER(f)                                                  \
+    static void __cdecl f(void);                                        \
+    __declspec(allocate(".CRT$XCU")) void(__cdecl * f ## _) (void) = f; \
     static void __cdecl f(void)
 
 #elif defined(__GNUC__)
 
-#define INITIALIZER(f)                                                         
\
-    static void f(void) __attribute__((constructor));                          
\
+#define INITIALIZER(f)                                \
+    static void f(void) __attribute__((constructor)); \
     static void f(void)
 
 #endif
@@ -97,8 +97,7 @@
     DeleteCriticalSection(&preadsc);
 }
 
-INITIALIZER(initialize)
-{
+INITIALIZER(initialize){
     InitializeCriticalSection(&preadsc);
     atexit(deinitialize);
 }

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to