Fix strncpy()/strncat() usage in check_for_driver(). From Johannes Meixner at SuSE.

merge-requests/1/head
Julien BLACHE 2007-10-25 13:25:42 +00:00
rodzic b349d9c500
commit cba7922706
2 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -1,6 +1,8 @@
2007-10-25 Julien Blache <jb@jblache.org>
* sanei/sanei_ab306.c: Fix boundary checking after the for() loop
in sanei_ab306_open(). From Johannes Meixner at SuSE.
* backend/as6e.c: Fix strncpy()/strncat() usage in
check_for_driver(). From Johannes Meixner at SuSE.
2007-10-25 Pierre Willenbrock <pierre@pirsoft.dnsalias.org>
* backend/genesys_gl841.c: Hopefully removed the remaining hardcoded

Wyświetl plik

@ -811,9 +811,11 @@ check_for_driver (const char *devname)
dir[count - offset] = path[count];
count++;
}
strncpy (fullname, dir, NAMESIZE);
strncat (fullname, "/", NAMESIZE);
strncat (fullname, devname, NAMESIZE);
/* use sizeof(fullname)-1 to make sure there is at least one padded null byte */
strncpy (fullname, dir, sizeof(fullname)-1);
/* take into account that fullname already contains non-null bytes */
strncat (fullname, "/", sizeof(fullname)-strlen(fullname)-1);
strncat (fullname, devname, sizeof(fullname)-strlen(fullname)-1);
if (!stat (fullname, &statbuf))
{
modes = statbuf.st_mode;