mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
Fixed a potential buffer overflow problem, in the device name handling.
PR: bin/15101
This commit is contained in:
parent
73f2a3c2c8
commit
3712337aef
1 changed files with 9 additions and 7 deletions
|
|
@ -33,6 +33,7 @@ static const char rcsid[] =
|
|||
#include <sys/file.h>
|
||||
#include <sys/cdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/param.h>
|
||||
#include <histedit.h>
|
||||
|
||||
#define VERSION "2.0"
|
||||
|
|
@ -1036,17 +1037,18 @@ char *parse (char *buf, int *cmd)
|
|||
|
||||
int open_cd ()
|
||||
{
|
||||
char devbuf[80];
|
||||
char devbuf[MAXPATHLEN];
|
||||
|
||||
if (fd > -1)
|
||||
return (1);
|
||||
|
||||
if (*cdname == '/')
|
||||
strcpy (devbuf, cdname);
|
||||
else if (*cdname == 'r')
|
||||
sprintf (devbuf, "/dev/%s", cdname);
|
||||
else
|
||||
sprintf (devbuf, "/dev/r%s", cdname);
|
||||
if (*cdname == '/') {
|
||||
snprintf (devbuf, MAXPATHLEN, "%s", cdname);
|
||||
} else if (*cdname == 'r') {
|
||||
snprintf (devbuf, MAXPATHLEN, "/dev/%s", cdname);
|
||||
} else {
|
||||
snprintf (devbuf, MAXPATHLEN, "/dev/r%s", cdname);
|
||||
}
|
||||
|
||||
fd = open (devbuf, O_RDONLY);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue