containers / composefs

a file system for mounting container images
GNU General Public License v2.0
421 stars 29 forks source link

mountcomposefs: Handle empty basedir option #265

Closed eriksjolund closed 5 months ago

eriksjolund commented 5 months ago

Fail with an error message if any of the basedir option paths is an empty string.

eriksjolund commented 5 months ago

An empty string might occur anywhere in the colon-separated list.

cgwalters commented 5 months ago

man strtok_r here says:

From the above description, it follows that a sequence of two or more contiguous delimiter bytes in the parsed string is considered to be a single delimiter, and that delimiter bytes at the start or end of the string are ignored. Put another way: the tokens returned by strtok() are always nonempty strings. Thus, for example, given the string "aaa;;bbb,", successive calls to strtok() that specify the delimiter string ";," would return the strings "aaa" and "bbb", and then a null pointer.