Skip to content

Fix potential NULL pointer dereference in auth.c#851

Open
GorComComputing wants to merge 1 commit intoyandex:masterfrom
GorComComputing:fix-bug-DEREF_OF_NULL
Open

Fix potential NULL pointer dereference in auth.c#851
GorComComputing wants to merge 1 commit intoyandex:masterfrom
GorComComputing:fix-bug-DEREF_OF_NULL

Conversation

@GorComComputing
Copy link

@GorComComputing GorComComputing commented May 30, 2025

The issue I'm addressing is a potential NULL pointer dereference in the auth.c file when accessing client->received_password.password or client->password.password without sufficient prior validation. In some cases, if client == NULL or those fields are not set, this can lead to undefined behavior or crashes during authentication flow.

This change ensures that all accesses to these fields are guarded by checks on client and its subfields before they're used. The logic has been simplified and centralized to avoid redundant NULL checks and make the code safer.

@rkhapov
Copy link
Collaborator

rkhapov commented May 30, 2025

Hi! Thanks for interesting in project!

Could you please write more verbose description about the problem you solve and the cases of odyssey usage which fails in (or because of) changes lines?

@GorComComputing GorComComputing force-pushed the fix-bug-DEREF_OF_NULL branch from d3cdaea to e9e11ab Compare June 2, 2025 07:15
@GorComComputing GorComComputing changed the title fix: DEREF OF NULL Fix potential NULL pointer dereference in auth.c Jun 2, 2025
@GorComComputing
Copy link
Author

Hi rkhapov,

Thanks for reviewing my patch!

The issue I'm addressing is a potential NULL pointer dereference in the auth.c file when accessing client->received_password.password or client->password.password without sufficient prior validation. In some cases, if client == NULL or those fields are not set, this can lead to undefined behavior or crashes during authentication flow.

This change ensures that all accesses to these fields are guarded by checks on client and its subfields before they're used. The logic has been simplified and centralized to avoid redundant NULL checks and make the code safer.

I believe the fix is important for stability, especially under edge conditions like malformed client credentials or missing password data due to misconfiguration or network issues.

Best regards,
Eugeny Goryachev

@rkhapov
Copy link
Collaborator

rkhapov commented Jul 5, 2025

i've read usages of this sasl functions and i think, that client will never be NULL here...

seems like check client == NULL is obsolete here

have you met the use case of odyssey when client was NULL ?

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

Successfully merging this pull request may close these issues.

2 participants