Message ID | 1459535615-16683-3-git-send-email-holger@freyther.de |
---|---|
State | Superseded |
Headers | show |
On Fri, Apr 01, 2016 at 08:33:35PM +0200, Holger Freyther wrote: > From: Holger Hans Peter Freyther <holger@moiji-mobile.com> > > We should not return a subscriber in case it was not written to > the database. Instead free the memory allocated and return NULL. > Callers in gsm_04_08.c are prepared to have the creation fail. > > Related: OS Issue #1657 curious: 1657 says "VTY command seems to be able to crash OsmoNITB", how did that happen, and does this patch set change anything about it? ~Neels
> On 06 Apr 2016, at 12:37, Neels Hofmeyr <nhofmeyr@sysmocom.de> wrote: > >> >> Related: OS Issue #1657 > > curious: 1657 says "VTY command seems to be able to crash OsmoNITB", how did > that happen, and does this patch set change anything about it? I don't know. My test tries to explore it but right now I think OS#1657 is not an issue.
diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c index 17bea24..267b5ef 100644 --- a/openbsc/src/libmsc/db.c +++ b/openbsc/src/libmsc/db.c @@ -523,8 +523,11 @@ struct gsm_subscriber *db_create_subscriber(const char *imsi) "(%s, datetime('now'), datetime('now')) ", imsi ); - if (!result) + if (!result) { LOGP(DDB, LOGL_ERROR, "Failed to create Subscriber by IMSI.\n"); + subscr_put(subscr); + return NULL; + } subscr->id = dbi_conn_sequence_last(conn, NULL); strncpy(subscr->imsi, imsi, GSM_IMSI_LENGTH-1); dbi_result_free(result);
From: Holger Hans Peter Freyther <holger@moiji-mobile.com> We should not return a subscriber in case it was not written to the database. Instead free the memory allocated and return NULL. Callers in gsm_04_08.c are prepared to have the creation fail. Related: OS Issue #1657 --- openbsc/src/libmsc/db.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)