New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expecting time_t == unsigned long is not portable #484
Comments
One more usage: cyrus-sasl/saslauthd/saslcache.c Line 177 in 1f1c3db
|
bgermann
added a commit
to bgermann/cyrus-sasl
that referenced
this issue
Mar 20, 2024
In some format strings, it is expected that time_t is long. long is 32 bit for 32 bit architectures, while time_t might be 64 bit. Extend the format string specifiers to long long, which is guaranteed to consist of 64 bits. Closes: cyrusimap#484 Signed-off-by: Bastian Germann <bage@debian.org>
bgermann
added a commit
to bgermann/cyrus-sasl
that referenced
this issue
Mar 20, 2024
In some format strings, it is expected that time_t is long. long is 32 bit for 32 bit architectures, while time_t might be 64 bit. Extend the format string specifiers to long long, which is guaranteed to consist of 64 bits. Closes: cyrusimap#484 Signed-off-by: Bastian Germann <bage@debian.org>
bgermann
added a commit
to bgermann/cyrus-sasl
that referenced
this issue
Mar 20, 2024
In some format strings, it is expected that time_t is the same size as long. long is 32 bit for 32 bit architectures, while time_t might be 64 bit. Extend the format string specifiers to long long, which can hold a time_t regardless of the platform and libc configuration. Closes: cyrusimap#484 Signed-off-by: Bastian Germann <bage@debian.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In some source codes, it is expected that time_t == unsigned long:
cyrus-sasl/lib/saslutil.c
Lines 283 to 286 in 1f1c3db
cyrus-sasl/plugins/cram.c
Line 138 in 1f1c3db
cyrus-sasl/plugins/otp.c
Lines 648 to 649 in 1f1c3db
cyrus-sasl/plugins/otp.c
Lines 709 to 710 in 1f1c3db
But it is not portable, for example, 32bit arch (long=32bit) with 64bit time_t platforms,
and such mis-usage in printf/scanf cause unwanted memory access, and unwanted result.
The text was updated successfully, but these errors were encountered: