strncpy->strlcpy. use sizeof instead of numbers.
This commit is contained in:
parent
f896087186
commit
6ac4e27787
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: ossaudio.c,v 1.30 2014/09/09 10:45:18 nat Exp $ */
|
/* $NetBSD: ossaudio.c,v 1.31 2017/02/10 08:50:27 maya Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||||
@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__RCSID("$NetBSD: ossaudio.c,v 1.30 2014/09/09 10:45:18 nat Exp $");
|
__RCSID("$NetBSD: ossaudio.c,v 1.31 2017/02/10 08:50:27 maya Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is an OSS (Linux) sound API emulator.
|
* This is an OSS (Linux) sound API emulator.
|
||||||
@ -497,12 +497,9 @@ audio_ioctl(int fd, unsigned long com, void *argp)
|
|||||||
*(struct count_info *)argp = cntinfo;
|
*(struct count_info *)argp = cntinfo;
|
||||||
break;
|
break;
|
||||||
case SNDCTL_SYSINFO:
|
case SNDCTL_SYSINFO:
|
||||||
strncpy(tmpsysinfo.product, "OSS/NetBSD", 31);
|
strlcpy(tmpsysinfo.product, "OSS/NetBSD", sizeof tmpsysinfo.product);
|
||||||
tmpsysinfo.product[31] = 0;
|
strlcpy(tmpsysinfo.version, version, sizeof tmpsysinfo.version);
|
||||||
strncpy(tmpsysinfo.version, version, 31);
|
strlcpy(tmpsysinfo.license, license, sizeof tmpsysinfo.license);
|
||||||
tmpsysinfo.version[31] = 0;
|
|
||||||
strncpy(tmpsysinfo.license, license, 15);
|
|
||||||
tmpsysinfo.license[15] = 0;
|
|
||||||
tmpsysinfo.versionnum = SOUND_VERSION;
|
tmpsysinfo.versionnum = SOUND_VERSION;
|
||||||
memset(tmpsysinfo.options, 0, 8);
|
memset(tmpsysinfo.options, 0, 8);
|
||||||
tmpsysinfo.numaudios = OSS_MAX_AUDIO_DEVS;
|
tmpsysinfo.numaudios = OSS_MAX_AUDIO_DEVS;
|
||||||
@ -550,8 +547,8 @@ audio_ioctl(int fd, unsigned long com, void *argp)
|
|||||||
if (idata & AUDIO_PROP_MMAP)
|
if (idata & AUDIO_PROP_MMAP)
|
||||||
idat |= DSP_CAP_MMAP;
|
idat |= DSP_CAP_MMAP;
|
||||||
idat = PCM_CAP_INPUT | PCM_CAP_OUTPUT;
|
idat = PCM_CAP_INPUT | PCM_CAP_OUTPUT;
|
||||||
strncpy(tmpaudioinfo->name, tmpaudiodev.name, 64);
|
strlcpy(tmpaudioinfo->name, tmpaudiodev.name,
|
||||||
tmpaudioinfo->name[63] = 0;
|
sizeof tmpaudioinfo->name);
|
||||||
tmpaudioinfo->busy = tmpinfo.play.open;
|
tmpaudioinfo->busy = tmpinfo.play.open;
|
||||||
tmpaudioinfo->pid = -1;
|
tmpaudioinfo->pid = -1;
|
||||||
tmpaudioinfo->caps = idat;
|
tmpaudioinfo->caps = idat;
|
||||||
@ -799,7 +796,7 @@ getdevinfo(int fd)
|
|||||||
di->devmask |= 1 << dp->code;
|
di->devmask |= 1 << dp->code;
|
||||||
if (mi.un.v.num_channels == 2)
|
if (mi.un.v.num_channels == 2)
|
||||||
di->stereomask |= 1 << dp->code;
|
di->stereomask |= 1 << dp->code;
|
||||||
strncpy(di->names[i], mi.label.name,
|
strlcpy(di->names[i], mi.label.name,
|
||||||
sizeof di->names[i]);
|
sizeof di->names[i]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -866,8 +863,8 @@ mixer_ioctl(int fd, unsigned long com, void *argp)
|
|||||||
omi = argp;
|
omi = argp;
|
||||||
if (com == SOUND_MIXER_INFO)
|
if (com == SOUND_MIXER_INFO)
|
||||||
omi->modify_counter = 1;
|
omi->modify_counter = 1;
|
||||||
strncpy(omi->id, adev.name, sizeof omi->id);
|
strlcpy(omi->id, adev.name, sizeof omi->id);
|
||||||
strncpy(omi->name, adev.name, sizeof omi->name);
|
strlcpy(omi->name, adev.name, sizeof omi->name);
|
||||||
return 0;
|
return 0;
|
||||||
case SOUND_MIXER_READ_RECSRC:
|
case SOUND_MIXER_READ_RECSRC:
|
||||||
if (di->source == -1)
|
if (di->source == -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user