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

topology: fix potential null pointer from strchr #91

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions topology/pre-process-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ static int tplg_pp_get_widget_name(struct tplg_pre_processor *tplg_pp,

/* get class name */
args = strchr(string, '.');
if (!args) {
SNDERR("Error getting class name for %s\n", string);
return -EINVAL;
}

class_name = calloc(1, strlen(string) - strlen(args) + 1);
if (!class_name)
return -ENOMEM;
Expand Down
5 changes: 5 additions & 0 deletions topology/pre-process-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,11 @@ static int tplg_pp_add_object_tuple_section(struct tplg_pre_processor *tplg_pp,
}

type = strchr(token_ref, '.');
if(!type) {
SNDERR("Error getting type for %s\n", token_ref);
return -EINVAL;
}

token = calloc(1, strlen(token_ref) - strlen(type) + 1);
if (!token)
return -ENOMEM;
Expand Down