tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: stack overflow in getaddrinfo(3) with a small-sized stack in pthreads



    Date:        Mon, 29 Nov 2021 12:25:24 +0100
    From:        Anthony Mallet <anthony.mallet%laas.fr@localhost>
    Message-ID:  <24996.47268.358308.412943%gargle.gargle.HOWL@localhost>

  | In addition, I just noticed that res_nquery(3) in
  | libc/resolv/res_query.c uses a similar buffer but of size
  | min(PACKETSZ, 1024). PACKETSZ seems to be 512 bytes only.

That is as it shoukd be.

  | So it seems that the two functions are not consistent wrt. the buffer
  | size. Do you think I should PR this?

PR tge huge stack array if yiu want, but not the different sizes.

DNS queries (via UDP) are limited to max 512, as that is what the
protocol always required, so can be handled by everything (or should be).
Further, that's big enough fro almost every query, in which the only
large object is thd domain name to lookup which is limited to 256 bytes.

Replies however can be any size (allowed by UDP) as the query can inform
tge server what max size reply csn be received.

kre


Home | Main Index | Thread Index | Old Index