Replace a couple sprintf() with snprintf()
This commit is contained in:
@@ -42,12 +42,12 @@ int tap_open(char *dev)
|
||||
int i, fd;
|
||||
|
||||
if( *dev ) {
|
||||
sprintf(tapname, "/dev/%s", dev);
|
||||
snprintf(tapname, sizeof tapname, "/dev/%s", dev);
|
||||
return open(tapname, O_RDWR);
|
||||
}
|
||||
|
||||
for(i=0; i < 255; i++) {
|
||||
sprintf(tapname, "/dev/tap%d", i);
|
||||
snprintf(tapname, sizeof tapname, "/dev/tap%d", i);
|
||||
/* Open device */
|
||||
if( (fd=open(tapname, O_RDWR)) > 0 ) {
|
||||
sprintf(dev, "tap%d",i);
|
||||
|
||||
@@ -42,12 +42,12 @@ int tun_open(char *dev)
|
||||
int i, fd;
|
||||
|
||||
if( *dev ) {
|
||||
sprintf(tunname, "/dev/%s", dev);
|
||||
snprintf(tunname, sizeof tunname, "/dev/%s", dev);
|
||||
return open(tunname, O_RDWR);
|
||||
}
|
||||
|
||||
for(i=0; i < 255; i++){
|
||||
sprintf(tunname, "/dev/tun%d", i);
|
||||
snprintf(tunname, sizeof tunname, "/dev/tun%d", i);
|
||||
/* Open device */
|
||||
if( (fd=open(tunname, O_RDWR)) > 0 ){
|
||||
sprintf(dev, "tun%d", i);
|
||||
|
||||
Reference in New Issue
Block a user