From 9b9e5fafd821d6e3371dd140dde9277e5903d017 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 26 Nov 2019 16:35:53 +0000 Subject: [PATCH] database: Log error when network ID is out of range Signed-off-by: Michael Tremer --- src/database.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/database.c b/src/database.c index 5d808fe..dd4ae32 100644 --- a/src/database.c +++ b/src/database.c @@ -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); -- 2.39.2