mirror of
https://github.com/vel21ripn/nDPI.git
synced 2026-05-19 07:54:24 +00:00
Fix error in generic_proc_write()
This commit is contained in:
parent
bfd0090982
commit
33544aa469
1 changed files with 8 additions and 8 deletions
|
|
@ -78,25 +78,25 @@ generic_proc_write(struct ndpi_net *n, const char __user *buffer,
|
|||
skip = w_buf->cpos == w_buf->max - 1;
|
||||
|
||||
while(pos < length) {
|
||||
l = min(length,sizeof(buf)-1);
|
||||
l = min(length-pos,sizeof(buf)-1);
|
||||
|
||||
memset(buf,0,sizeof(buf));
|
||||
if (!(ACCESS_OK(VERIFY_READ, buffer+pos, l) &&
|
||||
!__copy_from_user(&buf[0], buffer+pos, l)))
|
||||
return -EFAULT;
|
||||
for(i = 0; i < l; i++) {
|
||||
for(i = 0; i < l; (*loff)++,i++) {
|
||||
c = buf[i];
|
||||
if(c == '\n' || !c) {
|
||||
if(w_buf->cpos) {
|
||||
if(ndpi_log_debug > 1)
|
||||
pr_info("%s:%s cmd %d:%s\n", __func__,n->ns_name,
|
||||
w_buf->cpos,&w_buf->cmd[0]);
|
||||
pr_info("%s:%s POS %lld cmd %d:'%s' i %d\n", __func__,n->ns_name,
|
||||
*loff,w_buf->cpos,&w_buf->cmd[0],i);
|
||||
r = (parse_line)(n,&w_buf->cmd[0]);
|
||||
memset(&w_buf->cmd[0],0,w_buf->cpos);
|
||||
skip = 0;
|
||||
w_buf->cpos = 0;
|
||||
if(r) return -EINVAL;
|
||||
}
|
||||
skip = 0;
|
||||
w_buf->cpos = 0;
|
||||
memset(&w_buf->cmd[0],0,cmd_size);
|
||||
if(r) return -EINVAL;
|
||||
} else {
|
||||
if(w_buf->cpos < w_buf->max - 1)
|
||||
w_buf->cmd[w_buf->cpos++] = c;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue