From d43e48ae731765bcd4627a40551a959a325aa898 Mon Sep 17 00:00:00 2001 From: Christophe Ronco Date: Wed, 15 Feb 2017 17:54:21 +0100 Subject: [PATCH] gprs: fix error check of gprs_cid_alloc function When there is no context id available, idmap_alloc and gprs_cid_alloc return max + 1. --- src/gprs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gprs.c b/src/gprs.c index 5015a2fc..6ed1c89d 100644 --- a/src/gprs.c +++ b/src/gprs.c @@ -313,7 +313,7 @@ static gboolean assign_context(struct pri_context *ctx, int use_cid) } else ctx->context.cid = gprs_cid_alloc(ctx->gprs); - if (ctx->context.cid == 0) + if (ctx->context.cid > idmap_get_max(cidmap)) return FALSE; for (l = ctx->gprs->context_drivers; l; l = l->next) {