Theo Buehler <[email protected]> writes: > On Fri, Jan 21, 2022 at 07:00:52PM +0100, Omar Polo wrote: >> Hello, >> >> The reminder plugin for gkrellm is broken, and has been for a long time >> apparently. It stores the reminders in a file and uses fscanf with %d >> into a time_t to read the date, which corrupts it. The invalid time is >> later passed to localtime(3) which returns NULL and the plugin crashes a >> bit later into strftime. >> >> The diff below is an attempt to fix the port. Is it fine to read >> directly a time_t with %lld or should I introduce a temp variable for >> that? > > I would say it's better to use a temporary long long, then assign the > result to time_t with inevitable truncation on platforms without 64-bit > time_t. On such platforms, scanf with %lld to a time_t would be > undefined behavior. > > From the high revision number and the dead HOMEPAGE I deduce that we > won't be able to upstream this, so I suppose your approach is good > enough. > > Either way ok
I opted for using a temporary variable and added a comment before the patch explaining the issue, thanks!
