don't accept any arbitrary string as 'name' as we use it in a path

osmo_identifier_valid() is likely much more strict than just checking
for invalid symbols in a path, but let's use it as we already have it
around.

Closes: OS#5748
This commit is contained in:
Harald Welte 2022-11-08 09:06:56 +01:00
parent 738bad8e48
commit 4a4efc0b96
1 changed files with 5 additions and 0 deletions

View File

@ -124,6 +124,11 @@ DEFUN(cfg_itd_line_dahdi, cfg_itd_line_dahdi_cmd, "line NAME dahdi SPAN_NAME",
struct isdntap_line *line;
int rc;
if (!osmo_identifier_valid(name)) {
vty_out(vty, "%% Sorry, '%s' is not a valid identifier%s", name, VTY_NEWLINE);
return CMD_WARNING;
}
line = isdntap_line_find(vty_itd, name);
if (line) {
if (strcmp(line->drvdata.dahdi.name, span_name)) {