Changeset 5377
- Timestamp:
- Jul 5, 2016 1:21:31 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/addr_resolv_sock.c
r5376 r5377 187 187 188 188 /* Enumerate each item in the result */ 189 rc = 0;190 189 for (i=0; i<*count && res; res=res->ai_next) { 191 190 /* Ignore unwanted address families */ … … 195 194 /* Store canonical name (possibly truncating the name) */ 196 195 if (res->ai_canonname) { 197 pj_ansi_strncpy(ai[ rc].ai_canonname, res->ai_canonname,198 sizeof(ai[ rc].ai_canonname));199 ai[ rc].ai_canonname[sizeof(ai[rc].ai_canonname)-1] = '\0';196 pj_ansi_strncpy(ai[i].ai_canonname, res->ai_canonname, 197 sizeof(ai[i].ai_canonname)); 198 ai[i].ai_canonname[sizeof(ai[i].ai_canonname)-1] = '\0'; 200 199 } else { 201 pj_ansi_strcpy(ai[ rc].ai_canonname, nodecopy);200 pj_ansi_strcpy(ai[i].ai_canonname, nodecopy); 202 201 } 203 202 204 203 /* Store address */ 205 204 PJ_ASSERT_ON_FAIL(res->ai_addrlen <= sizeof(pj_sockaddr), continue); 206 pj_memcpy(&ai[ rc].ai_addr, res->ai_addr, res->ai_addrlen);207 PJ_SOCKADDR_RESET_LEN(&ai[ rc].ai_addr);205 pj_memcpy(&ai[i].ai_addr, res->ai_addr, res->ai_addrlen); 206 PJ_SOCKADDR_RESET_LEN(&ai[i].ai_addr); 208 207 209 208 /* Next slot */ 210 ++ rc;211 } 212 213 *count = rc;209 ++i; 210 } 211 212 *count = i; 214 213 215 214 freeaddrinfo(orig_res);
Note: See TracChangeset
for help on using the changeset viewer.