[Autosec-devel] sonar/src target.c,1.18,1.19
Brought to you by:
red0x
From: Jacob F. <ph...@us...> - 2004-06-18 09:39:32
|
Update of /cvsroot/autosec/sonar/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16344 Modified Files: target.c Log Message: Fixed a bug where sonar_find_target would get stuck in an infinite loop if a match for the target could not be found Index: target.c =================================================================== RCS file: /cvsroot/autosec/sonar/src/target.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** target.c 13 Apr 2004 03:42:08 -0000 1.18 --- target.c 18 Jun 2004 09:39:22 -0000 1.19 *************** *** 139,143 **** sonar_find_target(sonar_t * this, struct addrinfo * ai) { ! target_t *res = NULL; uint32_t start, end, longtmp; struct sockaddr_in *sa; --- 139,143 ---- sonar_find_target(sonar_t * this, struct addrinfo * ai) { ! target_t *res = NULL, *head; uint32_t start, end, longtmp; struct sockaddr_in *sa; *************** *** 149,152 **** --- 149,153 ---- res = this->vectors; + head=res; if(res->addrinfo) *************** *** 181,184 **** --- 182,187 ---- if(res->addrinfo) { + if(memcmp(res->addrinfo, ai, sizeof(struct addrinfo)) == 0) + return res; assert(res->addrinfo->ai_addr != NULL); switch (res->addrinfo->ai_family) *************** *** 203,209 **** return NULL; } - if(memcmp(res->addrinfo, ai, sizeof(struct addrinfo)) == 0) - return res; } } return NULL; --- 206,213 ---- return NULL; } } + /* we've run through the list and didn't find a match */ + if(res==head) + return NULL; } return NULL; |