[sr-dev] git:master: usrloc(k): better safety check for null record access
Daniel-Constantin Mierla
miconda at gmail.com
Wed Jun 13 17:31:00 CEST 2012
Module: sip-router
Branch: master
Commit: 748b79fdeba12736b109dfbd77a3e9bb04c80b97
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=748b79fdeba12736b109dfbd77a3e9bb04c80b97
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: Wed Jun 13 17:29:51 2012 +0200
usrloc(k): better safety check for null record access
---
modules_k/usrloc/udomain.c | 16 +++++++---------
1 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/modules_k/usrloc/udomain.c b/modules_k/usrloc/udomain.c
index 1464c29..cf7807e 100644
--- a/modules_k/usrloc/udomain.c
+++ b/modules_k/usrloc/udomain.c
@@ -1003,16 +1003,14 @@ int get_urecord(udomain_t* _d, str* _aor, struct urecord** _r)
sl = aorhash&(_d->size-1);
r = _d->table[sl].first;
- if(r!=NULL) {
- for(i = 0; i < _d->table[sl].n; i++) {
- if((r->aorhash==aorhash) && (r->aor.len==_aor->len)
- && !memcmp(r->aor.s,_aor->s,_aor->len)){
- *_r = r;
- return 0;
- }
-
- r = r->next;
+ for(i = 0; r!=NULL && i < _d->table[sl].n; i++) {
+ if((r->aorhash==aorhash) && (r->aor.len==_aor->len)
+ && !memcmp(r->aor.s,_aor->s,_aor->len)){
+ *_r = r;
+ return 0;
}
+
+ r = r->next;
}
} else {
/* search in DB */
More information about the sr-dev
mailing list