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

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 c812e7a..1464c29 100644
--- a/modules_k/usrloc/udomain.c
+++ b/modules_k/usrloc/udomain.c
@@ -1003,14 +1003,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