Skip to content

plugins: handle allocation failures in radius and winbind - #629

Open
grey3228 wants to merge 1 commit into
ppp-project:masterfrom
grey3228:fix/alloc_failures
Open

plugins: handle allocation failures in radius and winbind#629
grey3228 wants to merge 1 commit into
ppp-project:masterfrom
grey3228:fix/alloc_failures

Conversation

@grey3228

@grey3228 grey3228 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Static analysis found unchecked malloc() and strdup() results in the RADIUS and winbind plugins. Allocation failures could therefore result in NULL pointer dereferences.

This change:

  • checks the base64 output buffer allocation in the winbind plugin;
  • checks both RADIUS realm server-list allocations before initialization;
  • checks the structure and string allocations used for avpair options;
  • frees partially allocated RADIUS objects before invoking novm().

Out-of-memory conditions remain fatal through the existing novm() handler.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

The RADIUS and winbind plugins dereference memory allocation results
without first checking for failure. This can crash pppd when memory is
exhausted.

Check the allocations before use and call novm(), consistent with other
allocation sites in pppd. Free partially allocated RADIUS objects before
invoking the fatal OOM handler.

Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
@paulusmack

Copy link
Copy Markdown
Collaborator

Looks fine. The added free() calls seem a little pointless when the process is about to terminate, but I guess they make the analyzers happier.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants