如今我们随便马虎地就能辨认出漏洞的函数,如下所示:
这一点异常重要,请谨记于心!是以,这两个指针在每次运行时都被设置一次(或者须要的话)。
- static ssize_t tostring_write(struct file *f, const char __user *buf,size_t len, loff_t *off)
- {
- char *bufk;
- int i,j;
- printk(KERN_INFO "Tostring: write()\n");
- bufk = kmalloc(len + 1, GFP_DMA);
- if (bufk){
- if (copy_from_user(bufk, buf, len))
- return -EFAULT;
- bufk[len] = '\0';
- i=0;
- while(i <len) {
- for (j=0;(j<10) && (bufk[j]=='*');j++);
- if (j == 10) {
- for (j=i+10;(bufk[j]!='\0') && (bufk[j] != '\n');j++);
- bufk[j]='\0';
- printk("Tostring: Cmd %s\n",bufk+i+10);
- switch(bufk[i+10]) {
- case 'H':
- tostring->tostring_read= tostring_read_hexa;
- break;
- case 'D':
- tostring->tostring_read= tostring_read_dec;
- break;
- case 'S':
- printk("Tostring: Delete stack\n");
- kfree(tostring->tostring_stack);
- tostring->tostring_stack=NULL;
- tostring->tostring_read=NULL;
- tostring->pointer=0;
- tostring->pointer_max=0;
- break;
- case 'N':
- printk("Tostring: Stack create with size %ld\n",local_strtoul(bufk+i+11,NULL,10));
推荐阅读
沙龙晃荡 | 去哪儿、陌陌、ThoughtWorks在主动化运维中的实践!10.28不见不散! 大年夜数据这个词,几乎天天都邑听到。不过谈到这个词典,要么是科技公司介绍新技巧、要么是专家学者介绍将>>>详细阅读
地址:http://www.17bianji.com/lsqh/38226.html
1/2 1