Skip to content

Commit

Permalink
Ensure we exactly match cfgstring prefix against 'tcm-user'
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Reid <[email protected]>
  • Loading branch information
Alex Reid committed Feb 24, 2023
1 parent 09e9f20 commit 93122af
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libtcmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,10 @@ static bool device_parse_cfg(struct tcmu_device *dev,
/* Check valid cfgstring */
oldptr = cfgstring;
ptr = strchr(oldptr, '/');
len = ptr-oldptr;
if (!ptr)
goto err_badcfg;
if (strncmp(cfgstring, "tcm-user", ptr-oldptr))
if (strncmp(cfgstring, "tcm-user", len) || cfgstring[len] != '/')
goto err_badcfg;

/* Get HBA name */
Expand Down

0 comments on commit 93122af

Please sign in to comment.