Permalink
Browse files

Fixed

  • Loading branch information...
1 parent 93dd940 commit 59e6aee7ae7e21e34c611ae01cee69fe276a1ffb @jsegura jsegura committed Sep 8, 2011
Showing with 13 additions and 11 deletions.
  1. +13 −11 kernelroll.c
View
@@ -70,17 +70,19 @@ asmlinkage int my_open(const char *path, int oflag, mode_t mode)
char* p;
int r;
- p = (char *)(path + strlen(path) - 4);
-
- if(rollfile != NULL && !strcmp(p, ".mp3")) {
- void *buf = kmalloc(len, GFP_KERNEL);
- memcpy(buf, path, len);
- printk(KERN_INFO "patching %s with %s\n", path, rollfile);
- memcpy((void *)path, rollfile, len);
- r = o_open(path, oflag, mode);
- memcpy((void *)path, buf, len);
- kfree(buf);
- } else {
+ if (strlen(path) > 4) {
+ p = (char *)(path + strlen(path) - 4);
+
+ if(rollfile != NULL && !strcmp(p, ".mp3")) {
+ void *buf = kmalloc(len, GFP_KERNEL);
+ memcpy(buf, path, len);
+ printk(KERN_INFO "patching %s with %s\n", path, rollfile);
+ memcpy((void *)path, rollfile, len);
+ r = o_open(path, oflag, mode);
+ memcpy((void *)path, buf, len);
+ kfree(buf);
+ }
+ }else {
r = o_open(path, oflag, mode);
}

0 comments on commit 59e6aee

Please sign in to comment.