[lkml]   [2001]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
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)
for (p =; 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?

Anders Fugmann

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

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