Re: clang: compile static analyzer

2022-01-20 Thread Andre Smagin
On Fri, 21 Jan 2022 00:45:56 +0100 Steffen Nurpmeso wrote: > I found scan-build to generate a lot of false warnings, so much indeed > that i stopped using it .. in summer 2017. You, and most others, (no sarcasm at all here) are much better at C than I will ever be. I am not even at "amateur" le

Re: kubsan tcp timer shift

2022-01-20 Thread Theo de Raadt
Alexander Bluhm wrote: > On Thu, Jan 20, 2022 at 07:02:43PM +, Miod Vallat wrote: > > > An unsinged TF_TIMER does not create that problem. > > > > Why don't you simply append an U suffix to TF_TMR_REXMT? > > There are a lot of TF_ flags. Ususally we dont put an U to hex > flags. The only

Re: clang: compile static analyzer

2022-01-20 Thread Steffen Nurpmeso
Alexander Bluhm wrote in : |On Fri, Jan 14, 2022 at 05:59:24PM +0100, Claudio Jeker wrote: |> On Fri, Jan 14, 2022 at 04:44:49PM +, Stuart Henderson wrote: |>> On 2022/01/14 16:52, Rafael Sadowski wrote: |>>> On Fri Jan 14, 2022 at 03:17:21PM +0100, Tobias Heider wrote: | clang ships

Re: clang: compile static analyzer

2022-01-20 Thread Alexander Bluhm
On Fri, Jan 14, 2022 at 05:59:24PM +0100, Claudio Jeker wrote: > On Fri, Jan 14, 2022 at 04:44:49PM +, Stuart Henderson wrote: > > On 2022/01/14 16:52, Rafael Sadowski wrote: > > > On Fri Jan 14, 2022 at 03:17:21PM +0100, Tobias Heider wrote: > > > > Hi, > > > > > > > > clang ships with a pret

Re: snmpd(8): fix exceptions in mps.c

2022-01-20 Thread Martijn van Duren
Disregard this one for now. If o_get returns -1 it indicates an error, so it should indicate this to the upper layers. However, the old code can't handle this and I kept this code as is so that we can have some time to let the dust settle around the new code (and easily switch back if needed). Chan

application.c be more paranoid for misbehaving backends

2022-01-20 Thread Martijn van Duren
There's a missing NULL check in appl_response(). This should only happenwhen a backend is misbehaving, so I only managed to find this because I'm actively bashing it right now. This should make us a little more future-proof. Code further down the path already has similar NULL checks against this v

snmpd(8): fix exceptions in mps.c

2022-01-20 Thread Martijn van Duren
When hitting an error case in mps_get{,next}req, mps assumes that no OID has been linked to the root element. However, in both the get as well as the getnext case it's already set when entering the mib.c code, so going the fail goto path will result in the intended OID/exception pair being appended

Re: kubsan tcp timer shift

2022-01-20 Thread Alexander Bluhm
On Thu, Jan 20, 2022 at 07:02:43PM +, Miod Vallat wrote: > > An unsinged TF_TIMER does not create that problem. > > Why don't you simply append an U suffix to TF_TMR_REXMT? There are a lot of TF_ flags. Ususally we dont put an U to hex flags. The only one that is used for shifting is TF_TMR

Re: ober_get_writebuf return correct length

2022-01-20 Thread Martijn van Duren
Forgot to mention, I checked all the instances of ober_get_writebuf I could find and they either don't use it for the actual length, or ber has been freshly initialised just before. So there's no problem here in the known consumers. On Thu, 2022-01-20 at 18:50 +0100, Martijn van Duren wrote: > Whi

Re: kubsan tcp timer shift

2022-01-20 Thread Miod Vallat
> An unsinged TF_TIMER does not create that problem. Why don't you simply append an U suffix to TF_TMR_REXMT?

kubsan tcp timer shift

2022-01-20 Thread Alexander Bluhm
Hi, TCP timers also shift undefined values. kubsan: netinet/tcp_input.c:1027:4: shift: left shift of 67108864 by 5 places cannot be represented in type 'int' The problem is hidden behind a bunch of macros: TCP_SETUP_ACK(tp, tiflags, m); #define TCP_SETUP_ACK(tp, tiflags

ober_get_writebuf return correct length

2022-01-20 Thread Martijn van Duren
While reading through ber.c I noticed that ober_get_writebuf can return the wrong length when called multiple times on the same ber instance. This is because ober_get_writebuf uses br_wend to calculate the length, while ober_write_elements uses that to determine the size of the buffer. ober_write_

Re: kubsan null pointer calculations

2022-01-20 Thread Todd C . Miller
On Thu, 20 Jan 2022 15:04:07 +0100, Alexander Bluhm wrote: > snprintf(9) allows NULL pointer if size is 0. But doing NULL pointer > arithmetic is undefined behavior. Check that size is positive > before doing that. While the use NUL char for string termination. > > Pfkey import_flow() must do t

kubsan null pointer calculations

2022-01-20 Thread Alexander Bluhm
Hi, snprintf(9) allows NULL pointer if size is 0. But doing NULL pointer arithmetic is undefined behavior. Check that size is positive before doing that. While the use NUL char for string termination. Pfkey import_flow() must do the NULL check before doing pointer calculations. ok? bluhm In

remove snmpe.c transactionid

2022-01-20 Thread Martijn van Duren
This was from a sequence of early attempts to work towards a new application layer. I can give more reasoning behind it, but the bottom line is that it's currently dead weight. OK to remove this code again? martijn@ Index: snmpd.h =

Re: rpki-client move X509 checks for TA to cert.c

2022-01-20 Thread Theo Buehler
On Thu, Jan 20, 2022 at 12:02:55PM +0100, Claudio Jeker wrote: > Lets move the time validity checks for TA to cert.c. ta_parse already > checks the pubkey so why not do all validity checks. ok > While doing that remove the code to extract the subject. All errors print > the filename and the subje

rpki-client move X509 checks for TA to cert.c

2022-01-20 Thread Claudio Jeker
Lets move the time validity checks for TA to cert.c. ta_parse already checks the pubkey so why not do all validity checks. While doing that remove the code to extract the subject. All errors print the filename and the subject itself is just extra information that is less helpful in the use case of