]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
fix oops on rmmod capidrv
authorKarsten Keil <kkeil@suse.de>
Fri, 25 Jan 2008 12:42:23 +0000 (13:42 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 8 Feb 2008 20:01:48 +0000 (12:01 -0800)
patch eb36f4fc019835cecf0788907f6cab774508087b in mainline.

Fix overwriting the stack with the version string
(it is currently 10 bytes + zero) when unloading the
capidrv module. Safeguard against overwriting it
should the version string grow in the future.

Should fix Kernel Bug Tracker Bug 9696.

Signed-off-by: Gerd v. Egidy <gerd.von.egidy@intra2net.com>
Acked-by: Karsten Keil <kkeil@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/isdn/capi/capidrv.c

index 23b6f7bc16b7e53ebac2a6d73e76608bcaa67ecf..f65b7f9d3f434cd8647a56757f9d45640292591c 100644 (file)
@@ -2306,13 +2306,14 @@ static int __init capidrv_init(void)
 
 static void __exit capidrv_exit(void)
 {
-       char rev[10];
+       char rev[32];
        char *p;
 
        if ((p = strchr(revision, ':')) != 0) {
-               strcpy(rev, p + 1);
-               p = strchr(rev, '$');
-               *p = 0;
+               strncpy(rev, p + 1, sizeof(rev));
+               rev[sizeof(rev)-1] = 0;
+               if ((p = strchr(rev, '$')) != 0)
+                       *p = 0;
        } else {
                strcpy(rev, " ??? ");
        }