Re: [PATCH v4] Improve ptrace-error detection on Linux targets

Tom Tromey
2019-09-25T22:04:39Z

>> Unrestricted sprintf gives me pause. Do we know own_buf is large
>> enough? Or can/should we truncate the text instead?

Sergio> I was also worried about this. I found other cases using sprintf, but
Sergio> their strings are not as big. I know own_buf comes from struct
Sergio> client_state, and its size of PBUFSIZ + 1. One option would be to use
Sergio> snprintf with this value. WDYT?

I think that would be fine.

>> I was wondering if each case should just return, or if checking each one
>> is the correct thing to do here.

Sergio> I don't have a strong opinion here, but I think it's more useful for the
Sergio> user if we print everything wrong in the first pass. I'm thinking of
Sergio> cases when starting GDB may take a while, for example: if we tell the
Sergio> user a list of problems that need to be solved, then she won't need to
Sergio> keep retrying.

Makes sense to me, thanks.

Tom