lkml.org 
[lkml]   [2001]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectQ: procfs entry.
Hi again.

I have a question about the function parsed for reading a procfs entry.

I've used the skeleton from drivers/char/misc.c, and all works
perfectly, but I see a potential flaw.



static int misc_read_proc(char *buf, char **start, off_t offset,
int len, int *eof, void *private)
{
.
.
written=0;
for (p = misc_list.next; p != &misc_list && written < len;
p = p->next) {

written += sprintf(buf+written, "%3i %s\n",p->minor,
p->name ?: "");
if (written < offset) {
offset -= written;
written = 0;
}
}
.
.


As I see it, there is a possibility to write beyond buf+len.
(if len<5)
If so is it ok, or should this be avoided at all cost?

TIA
Anders Fugmann



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:53    [W:0.028 / U:9.224 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site