Closed snarkmaster closed 1 year ago
Ok, here's a change to update the strncpy
invocation instead. The reason that this change is needed is that gcc -O3
will issue otherwise issue a (fatal) warning because with the current code, exe
might end up not being null-terminated:
If there is no null byte among the first n bytes of src, the string placed in dest will not be null-terminated.
Of course, it doesn't know that PATH_MAX
already accounts for null.
merged
There is no actual buffer overrun here, since
PATH_MAX
includes a null character (per @ming1 below). However,gcc -O3
issues a warning when "size of buffer" == "size ofstrncmp
" which becomes fatal sincebuild_with_liburing_src
specifies-Wall
.So, let just fix this to be "pedantically correct", and not simply "actually correct" :)