Module: sip-router
Branch: 3.2
Commit: cc952f8469dea60b9e7f0e70063046f086a2866f
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=cc952f8469dea60b9e7f0e70063046f086a2866f

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date:   Wed Jun 13 16:33:17 2012 +0200

usrloc(k): safety check for first record in udomain slot

- reported by David Kovarik, FS#234
(cherry picked from commit 31f404a98b09b5a6270e860574b16c9f9112c305)

---

 modules_k/usrloc/udomain.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/modules_k/usrloc/udomain.c b/modules_k/usrloc/udomain.c
index cd41bd2..ab753bb 100644
--- a/modules_k/usrloc/udomain.c
+++ b/modules_k/usrloc/udomain.c
@@ -856,14 +856,16 @@ int get_urecord(udomain_t* _d, str* _aor, struct 
urecord** _r)
                sl = aorhash&(_d->size-1);
                r = _d->table[sl].first;
 
-               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;
-                       }
+               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;
+                               r = r->next;
+                       }
                }
        } else {
                /* search in DB */


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to