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

Missing a terminator after strncpy in function Server_jack_init, which may cause read-overflow #221

Closed
Daybreak2019 opened this issue May 27, 2021 · 4 comments

Comments

@Daybreak2019
Copy link

Code snippet

Server_jack_init(Server *self)
{
    int i = 0;
    char client_name[32];  -----------> No initialization
    char name[16];
     .........
    strncpy(client_name, self->serverName, 31);  -------------> when length of self->serverName is 31,  client_name may has no terminator. It is a risk of read-overflow.
     .........
}

Description

Function: Server_jack_init
File: ad_jack.c
Call-path: boot (Python) -> Server_boot -> Server_jack_init
WarningType: read-overflow. Our analysis tool reported a warning at the call-site of strncpy. As client_name is not initialized, it may has no terminator after strncpy hence to cases read-overflow.
Also seen in Details

@Daybreak2019
Copy link
Author

Anyone can help confirm this issue? thanks.

@belangeo
Copy link
Owner

I'll take a look as soon as I get a chance. Thanks for reporting.

@belangeo
Copy link
Owner

belangeo commented Jun 3, 2021

Fixed. Turns out that the copy was completely useless!

@Daybreak2019
Copy link
Author

Fixed. Turns out that the copy was completely useless!

thanks

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

2 participants