[PATCH] elf: include terminating zero in n_namesz
authorMagnus Damm <magnus@valinux.co.jp>
Thu, 7 Dec 2006 04:37:56 +0000 (20:37 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Thu, 7 Dec 2006 16:39:38 +0000 (08:39 -0800)
The ELF32 spec says we should plus we include the zero on other platforms.

Signed-off-by: Magnus Damm <magnus@valinux.co.jp>
Cc: Daniel Jacobowitz <drow@false.org>
Cc: Roland McGrath <roland@redhat.com>
Cc: Jakub Jelinek <jakub@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/mips/kernel/irixelf.c

index a82fae221ce4b7a6ae7ab1650392287c54d042eb..1bbefbf433736dd113dbbacab8a09d0bdd351ad1 100644 (file)
@@ -1009,7 +1009,7 @@ static int notesize(struct memelfnote *en)
        int sz;
 
        sz = sizeof(struct elf_note);
-       sz += roundup(strlen(en->name), 4);
+       sz += roundup(strlen(en->name) + 1, 4);
        sz += roundup(en->datasz, 4);
 
        return sz;
@@ -1028,7 +1028,7 @@ static int writenote(struct memelfnote *men, struct file *file)
 {
        struct elf_note en;
 
-       en.n_namesz = strlen(men->name);
+       en.n_namesz = strlen(men->name) + 1;
        en.n_descsz = men->datasz;
        en.n_type = men->type;