I think the condition should still be strlen(fnamestr) < MaxPath, since fnamestr is assumed to be a path, that is why I added that test. I did allocate the 3 * MaxPath buffer to account for 2*strlen(fnamestr) plus some extra room for the shell script. For any MaxPath>58 the buffer will not overflow, but I can but be explicit there and be exact.
I think the condition should still be
strlen(fnamestr) < MaxPath
, sincefnamestr
is assumed to be a path, that is why I added that test. I did allocate the3 * MaxPath
buffer to account for2*strlen(fnamestr)
plus some extra room for the shell script. For anyMaxPath>58
the buffer will not overflow, but I can but be explicit there and be exact.