Repository navigation
Conversation
|
Are these internal functions ever called with a NULL from curl code? Would it be enough to protect against these at the public interface It can be "defense in depth" if the project decided to go with this |
9dd7817 to
2ec5c5f
Compare
|
@vszakats Thank you for the feedback. That makes complete sense. I have updated the PR to focus strictly on the public entry point:
|
Sure I think that's fine. I don't think it needs to be documented though. |
2ec5c5f to
d3bdb14
Compare
|
Updated: cast the return check to (time_t)-1 in lib517.c to prevent platform signedness warnings on AmigaOS/MS-DOS, and reverted the documentation change in curl_getdate.md. Rebased cleanly on latest master. |
d3bdb14 to
55e0b93
Compare
|
Good catch, removed the blank line. Thank you @vszakats! |
Calling curl_getdate() with a NULL date pointer unconditionally dereferenced the pointer in parsedate() at while(*date && (part < 6)), causing an immediate crash. This change hardens the public entry point: 1. curl_getdate() checks for NULL input and returns -1 immediately, matching its documented error return code for unparseable dates. 2. Unit test lib517 is extended to verify NULL pointer safety across all platforms. Signed-off-by: Filippo Tedeschi <filippotedeschi98@gmail.com>
55e0b93 to
302372f
Compare
|
Ah, understood! Updated to keep the newline above |
|
Thanks |
Calling
curl_getdate()with a NULL date pointer unconditionally dereferenced the pointer inparsedate()atwhile(*date && (part < 6)), causing a crash.This change hardens the public API entry point:
curl_getdate()validates thatpis non-NULL and immediately returns -1, matching its documented error return code for unparseable dates.lib517is extended to verifycurl_getdate(NULL, NULL) == -1.curl_getdatedocumentation is updated to specify the -1 return code on NULL input.Signed-off-by: Filippo Tedeschi filippotedeschi98@gmail.com