On Thu, Jan 26, 2023 at 9:42 AM Todd C. Miller <todd.mil...@millert.dev> wrote:
> On Thu, 26 Jan 2023 09:36:52 -0800, enh wrote: > > > it's quite possible that this could use _conv_num64(), but it wasn't > > obvious to me that that function's correct? (i haven't thought too hard > > about the overflow logic, but just the fact that result is an `int` seems > > odd?) > > It just returns a boolean value, 1 for OK, 0 for not OK. There is > a result parameter for the output value. The code is effectively > the same as _conv_num. I dislike that it uses int64_t instead of > time_t though. > yeah, but that's the copy & paste-o, no? (apologies if it's just too early for me to be looking at code yet...) doesn't this need to be int64_t? int result = 0; https://github.com/openbsd/src/blob/master/lib/libc/time/strptime.c#L613 (i think the overflow checks are insufficient in both copies of the function too, especially around the min and max values, but this seems like the biggest problem with the code.) > - todd >