aboutsummaryrefslogtreecommitdiffstats
path: root/src/db_hlr.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-10-10 23:20:26 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2017-10-15 05:52:39 +0200
commitb6837e36a34a1e9e7fafea822516e61285e3c09c (patch)
tree4c84e9a08d56e013bbb92df8a0b43e4b7f1cd4b9 /src/db_hlr.c
parent2e86ab3a8704462c55245370ebdce9f6b134792d (diff)
fix db_subscr_get_by_*(): clear output data; test in db_test.c
db_subscr_get_by_*() failed to clear the out-param struct, meaning that data could remain in a struct even though it is not present in the database. Always zero out the struct before writing to it. Adjust the db_test to catch this error by writing "-invalid-data-" to each struct before running db get functions. Change-Id: I038bd437452c87841d709fcdd5ac30ab1356b2db
Diffstat (limited to 'src/db_hlr.c')
-rw-r--r--src/db_hlr.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/db_hlr.c b/src/db_hlr.c
index 71f682d..cf6e4f8 100644
--- a/src/db_hlr.c
+++ b/src/db_hlr.c
@@ -379,6 +379,8 @@ static int db_sel(struct db_context *dbc, sqlite3_stmt *stmt, struct hlr_subscri
if (!subscr)
goto out;
+ *subscr = (struct hlr_subscriber){};
+
/* obtain the various columns */
subscr->id = sqlite3_column_int64(stmt, 0);
SL3_TXT(subscr->imsi, stmt, 1);