3 ms·
> after verifying that the iface parameter does not contain a directory separator. No, this is terrible practice. The correct solution is to verify that the in
by amluto 8y ago
> after verifying that the iface parameter does not contain a directory separator.
No, this is terrible practice. The correct solution is to verify that the interface name is well formed. Use a whitelist, not a blacklist. And, for good measure, use a real path manipulation library if available.
- okdana 8y agoHow are you going to white-list network-interface names? On Linux at least you can name them almost anything you want: % sudo ip link set eth3 down % sudo ip link set eth3 name "'deal-with-it'" % sudo ip link show "'deal-with-it'" 5: 'deal-with-it': <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 10000 link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff The only interface-name restrictions iproute2 sets is that they can't contain NUL, slash, or white space, and they can't be longer than 15 characters.
- tedunangst 8y agoSo I guess the question is does a regex of [^/ ]{1,15} count as a whitelist or a blacklist?
- amluto 8y agoSo does Linux allow .. as an interface name? If so, that’s nuts.