Skip to content

[BUG] Unchecked strdup return values in hardsubx.c #2158

@Anayo-Anyafulu

Description

@Anayo-Anyafulu

Summary

In init_hardsubx() in src/lib_ccx/hardsubx.c, strdup() is called twice on lines 235-236 without checking for NULL. If memory allocation fails, subsequent use of these pointers could lead to undefined behavior.

Code

Line 235: char *pars_vec = strdup("debug_file");
Line 236: char *pars_values = strdup("/dev/null");

Suggested Fix

Add NULL checks for both strdup calls and free already allocated resources before returning NULL or calling fatal().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions