]> git.ipfire.org Git - people/ms/libloc.git/blobdiff - src/database.c
database: Log error when network ID is out of range
[people/ms/libloc.git] / src / database.c
index 5d808fe5ca9e93484982304a24001aab21994e87..dd4ae32cdd92b24677f25ceb5fa365c23ccad0a9 100644 (file)
@@ -467,8 +467,12 @@ LOC_EXPORT int loc_database_get_as(struct loc_database* db, struct loc_as** as,
 // Returns the network at position pos
 static int loc_database_fetch_network(struct loc_database* db, struct loc_network** network,
                struct in6_addr* address, unsigned int prefix, off_t pos) {
-       if ((size_t)pos >= db->networks_count)
+       if ((size_t)pos >= db->networks_count) {
+               DEBUG(db->ctx, "Network ID out of range: %jd/%jd\n",
+                       (intmax_t)pos, (intmax_t)db->networks_count);
                return -EINVAL;
+       }
+
 
        DEBUG(db->ctx, "Fetching network at position %jd\n", (intmax_t)pos);