Skip to content

Commit 872fffb

Browse files
committed
helpers: fix maximum interface name length check
Update helpers to enforce a maximum interface name length of 15 characters, matching the actual limit. In Linux, the last byte of the 16-byte array is reserved for the null terminator. Signed-off-by: Tomas Novotny <tomas@novotny.cz>
1 parent 12afbda commit 872fffb

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

helpers/labgrid-bound-connect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def main(ifname, address, port):
1515
raise ValueError("Empty interface name.")
1616
if any((c == "/" or c.isspace()) for c in ifname):
1717
raise ValueError(f"Interface name '{ifname}' contains invalid characters.")
18-
if len(ifname) > 16:
18+
if len(ifname) > 15:
1919
raise ValueError(f"Interface name '{ifname}' is too long.")
2020

2121
address = ipaddress.ip_address(address)

helpers/labgrid-raw-interface

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def main(program, options):
3838
raise ValueError("Empty interface name.")
3939
if any((c == "/" or c.isspace()) for c in options.ifname):
4040
raise ValueError(f"Interface name '{options.ifname}' contains invalid characters.")
41-
if len(options.ifname) > 16:
41+
if len(options.ifname) > 15:
4242
raise ValueError(f"Interface name '{options.ifname}' is too long.")
4343

4444
denylist = get_denylist()

0 commit comments

Comments
 (0)