Changeset 59203 in vbox
- Timestamp:
- Dec 21, 2015 5:21:56 PM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/VBox/Devices/Network/slirp/hostres.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/hostres.c
r59202 r59203 240 240 } 241 241 242 if (RT_UNLIKELY(pHdr->nscount != 0))243 {244 LogErr(("NAT: hostres: authority RRs in query\n"));245 refuse(pData, m, RCode_NotImp);246 return 1;247 }248 249 if (RT_UNLIKELY(pHdr->arcount != 0))250 {251 LogErr(("NAT: hostres: additional info RRs in query\n"));252 refuse(pData, m, RCode_NotImp);253 return 1;254 }255 256 242 if (RT_UNLIKELY(mlen < sizeof(*pHdr) 257 243 + /* qname */ 1 … … 379 365 * QTYPE and QCLASS 380 366 */ 381 if (RT_UNLIKELY(off + 4 !=mlen))382 { 383 LogErr(("NAT: hostres: question too short / too long\n"));367 if (RT_UNLIKELY(off + 4 > mlen)) 368 { 369 LogErr(("NAT: hostres: question too short\n")); 384 370 return refuse(pData, m, RCode_FormErr); 385 371 } … … 408 394 return refuse(pData, m, RCode_NotImp); 409 395 } 396 397 398 /** 399 * Check if there's anything after the question. If query says it 400 * has authority or additional records, ignore and drop them 401 * without parsing. 402 * 403 * We have already rejected queries with answer(s) before. We 404 * have ensured that qname in the question doesn't contain 405 * pointers, so truncating the buffer is safe. 406 */ 407 if (off < mlen) 408 { 409 int trailer = mlen - off; 410 411 LogDbg(("NAT: hostres: question %zu < mlen %zu\n", off, mlen)); 412 413 if (pHdr->nscount == 0 && pHdr->arcount == 0) 414 { 415 LogErr(("NAT: hostres: unexpected %d bytes after the question\n", trailer)); 416 return refuse(pData, m, RCode_FormErr); 417 } 418 419 LogDbg(("NAT: hostres: ignoring %d bytes of %s%s%s records\n", 420 trailer, 421 pHdr->nscount != 0 ? "authority" : "", 422 pHdr->nscount != 0 && pHdr->arcount != 0 ? " and " : "", 423 pHdr->arcount != 0 ? "additional" : "")); 424 425 m_adj(m, -trailer); 426 mlen -= trailer; 427 res->end = res->qlen = mlen; 428 429 pHdr->nscount = 0; 430 pHdr->arcount = 0; 431 } 432 410 433 411 434 /*
Note:
See TracChangeset
for help on using the changeset viewer.

