Bodo Eggert wrote:
> BTW2: However, I don't like the patch.
>
> I'd first check for a utf-8 signature, and if it's found, adjust the
> buffer offset by 3. Then I'd run the old code checking for the sh_bang.
> OTOH, I just read the patch and not the .c file, maybe (unlikely) my idea
> wouldn't work correctly.
I believe this wouldn't work. binfmt_script currently has the code
for (cp = bprm->buf+2; (*cp == ' ') || (*cp == '\t'); cp++);
to get out the (start of the) interpreter file name. This knows
implicitly that you need to skip two bytes #!; for UTF-8 signatures,
it would be 5 bytes.
Now, if you meant to suggest that bprm->buf should be adjusted (e.g.
through 'brpm->buf += 3'): this cannot work, either. It would break
subsequent binfmt modules which assume that bprm->buf is the first
1KiB (or so) of the file to be executed.
If you suggest that the patch should merely check for the signature,
and then skip it: this is what the patch does.
Regards,
Martin
P.S. I just noticed there is a
bprm->buf[BINPRM_BUF_SIZE - 1] = '\0';
which seems incorrect: it puts a null-byte into the buffer data,
thus (slightly) corrupting the data for subsequent binfmt modules
(although it already knows the file starts with #!, so the
subsequent modules will fail, anyway)
Also, I think the above loop should also terminate for '
*cp == '\0'
if there is neither a space nor a tab in the file.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|