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

Possible buffer underflow #72

Open
VoroninArtemii opened this issue Sep 5, 2024 · 0 comments
Open

Possible buffer underflow #72

VoroninArtemii opened this issue Sep 5, 2024 · 0 comments

Comments

@VoroninArtemii
Copy link

There may be buffer underflow:

attmap_get_value(entry, attmap_passwd_gecos, gecos, sizeof(gecos));

We have two checks before accessing the array buffer by index in the function attmap_get_value. And they are false because const char *attmap_passwd_gecos = "\"${gecos:-$cn}\"". This is the variable attr.

if (attr[0] != '"')

if ((attr[strlen(attr) - 1] != '"') ||
(expr_parse(attr + 1, buffer, buflen, entry_expand, (void *)entry) == NULL))

But after that we try to access the array by index -1:

if (buffer[strlen(buffer) - 1] == '"')

Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.
Author A. Voronin.

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

No branches or pull requests

1 participant