Skip to content
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

plugins/radius: incompatible cast #499

Open
yarda opened this issue Jun 24, 2024 · 2 comments
Open

plugins/radius: incompatible cast #499

yarda opened this issue Jun 24, 2024 · 2 comments

Comments

@yarda
Copy link
Contributor

yarda commented Jun 24, 2024

The following was found by static analysis, I think it could cause problems on 64 bits:

"Error: INCOMPATIBLE_CAST (CWE-119):
ppp-ppp-2.5.0/pppd/plugins/radius/avpair.c:756: incompatible_cast: Pointer ""&pair->lvalue"" points to an object whose effective type is ""unsigned int"" (32 bits, unsigned) but is dereferenced as a wider ""long"" (64 bits, signed). This may lead to memory corruption.
#  754|   	    case PW_TYPE_DATE:
#  755|   		strftime (buffer, sizeof (buffer), ""%m/%d/%y %H:%M:%S"",
#  756|-> 			  gmtime ((time_t *) & pair->lvalue));
#  757|   		strncpy(value, buffer, lv-1);
#  758|   		break;"
@yarda
Copy link
Contributor Author

yarda commented Jun 24, 2024

ppp-2.5.0

@paulusmack
Copy link
Collaborator

I agree, on a platform with 64-bit time_t, particularly a big-endian platform, this wouldn't be right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants