Messages in this thread | | | Date | Mon, 11 Oct 1999 10:29:22 +0200 | From | Matthew Wilcox <> | Subject | Re: [patch] two patches for your review |
| |
On Mon, Oct 11, 1999 at 07:44:42AM +0100, Tigran Aivazian wrote: > 2. http://www.ocston.org/~tigran/patches/binfmt-2.3.20.patch > > A simple optimization for ELF magic check along the lines of: > > - if (elf_ex.e_ident[0] != 0x7f || > - strncmp(&elf_ex.e_ident[1], "ELF", 3) != 0) > + if (strncmp(elf_ex.e_ident, ELFMAG, SELFMAG)) > > (I hope it doesn't break non-intel-endian worlds, but you tell me!)
Ah, Tigran, this is something I was about to send you.. strncmp doesn't make much sense there; it's not a string after all, it's a 4-byte magic number:
if (memcmp(elf_ex.e_ident, ELFMAG, SELFMAG) != 0)
makes much more sense. And if this makes a difference on other endian platforms, why are they doing a memset further down the file in the core dump routine? :-)
-- Matthew Wilcox <willy@bofh.ai> "Windows and MacOS are products, contrived by engineers in the service of specific companies. Unix, by contrast, is not so much a product as it is a painstakingly compiled oral history of the hacker subculture." - N Stephenson
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |