* Q: procfs entry.
@ 2001-05-18 23:33 Anders Peter Fugmann
0 siblings, 0 replies; only message in thread
From: Anders Peter Fugmann @ 2001-05-18 23:33 UTC (permalink / raw)
To: linux-kernel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-05-18 23:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-18 23:33 Q: procfs entry Anders Peter Fugmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox