Both of these commands:
$ nsjail -Mo --time_limit 0.7 --chroot / -- /bin/bash
$ nsjail -Mo --time_limit 🍌🍌🍌 --chroot / -- /bin/bash
will limit the execution time to 600 seconds (the default), or whatever is provided in the config if a config file is supplied.
And this will set the limit to 1 second, not 1.5 seconds:
$ nsjail -Mo --time_limit 1.5 --chroot / -- /bin/bash
It's understandable to only support integer durations, but I think invalid values should result in an error, not silently using the default.
This is the problematic code:
|
case 't': |
|
nsj->njc.set_time_limit((uint64_t)strtoull(optarg, NULL, 0)); |
|
break; |
It seems like it's calling strtoull without checking whether the entire argument constitutes an integer. strto... is called like that in several places
Both of these commands:
will limit the execution time to 600 seconds (the default), or whatever is provided in the config if a config file is supplied.
And this will set the limit to 1 second, not 1.5 seconds:
It's understandable to only support integer durations, but I think invalid values should result in an error, not silently using the default.
This is the problematic code:
nsjail/cmdline.cc
Lines 568 to 570 in d6454b4
It seems like it's calling strtoull without checking whether the entire argument constitutes an integer.
strto...is called like that in several places