summaryrefslogtreecommitdiff
path: root/sys/dev/isa/sbdsp.c
diff options
context:
space:
mode:
authorHakan Olsson <ho@cvs.openbsd.org>2003-04-27 11:22:55 +0000
committerHakan Olsson <ho@cvs.openbsd.org>2003-04-27 11:22:55 +0000
commitc670c56d6bb9915caf18009083d3515283a25fe1 (patch)
treeffee78ad4ad468acbebd70d511be258d28fdbd52 /sys/dev/isa/sbdsp.c
parentc9c7d16545b1bfad4519f491aa113a57ab7c7b2d (diff)
strcpy/sprintf cleanup of sys/dev. miod@, deraadt@ says to commit.
Diffstat (limited to 'sys/dev/isa/sbdsp.c')
-rw-r--r--sys/dev/isa/sbdsp.c127
1 files changed, 73 insertions, 54 deletions
diff --git a/sys/dev/isa/sbdsp.c b/sys/dev/isa/sbdsp.c
index 558ecd96efa..82fb921b9bd 100644
--- a/sys/dev/isa/sbdsp.c
+++ b/sys/dev/isa/sbdsp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sbdsp.c,v 1.21 2002/03/14 01:26:56 millert Exp $ */
+/* $OpenBSD: sbdsp.c,v 1.22 2003/04/27 11:22:53 ho Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -458,25 +458,25 @@ sbdsp_query_encoding(addr, fp)
switch (fp->index) {
case 0:
- strcpy(fp->name, AudioEulinear);
+ strlcpy(fp->name, AudioEulinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
return 0;
case 1:
- strcpy(fp->name, AudioEmulaw);
+ strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
return 0;
case 2:
- strcpy(fp->name, AudioEalaw);
+ strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
return 0;
case 3:
- strcpy(fp->name, AudioEslinear);
+ strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = emul;
@@ -487,25 +487,25 @@ sbdsp_query_encoding(addr, fp)
switch(fp->index) {
case 4:
- strcpy(fp->name, AudioEslinear_le);
+ strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
return 0;
case 5:
- strcpy(fp->name, AudioEulinear_le);
+ strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = emul;
return 0;
case 6:
- strcpy(fp->name, AudioEslinear_be);
+ strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
return 0;
case 7:
- strcpy(fp->name, AudioEulinear_be);
+ strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
@@ -1915,42 +1915,42 @@ sbdsp_mixer_query_devinfo(addr, dip)
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = SB_OUTPUT_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNmaster);
+ strlcpy(dip->label.name, AudioNmaster, sizeof dip->label.name);
dip->un.v.num_channels = chan;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume, sizeof dip->un.v.units.name);
return 0;
case SB_MIDI_VOL:
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = class;
dip->prev = AUDIO_MIXER_LAST;
dip->next = is1745 ? SB_MIDI_IN_MUTE : AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNfmsynth);
+ strlcpy(dip->label.name, AudioNfmsynth, sizeof dip->label.name);
dip->un.v.num_channels = chan;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume, sizeof dip->un.v.units.name);
return 0;
case SB_CD_VOL:
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = class;
dip->prev = AUDIO_MIXER_LAST;
dip->next = is1745 ? SB_CD_IN_MUTE : AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNcd);
+ strlcpy(dip->label.name, AudioNcd, sizeof dip->label.name);
dip->un.v.num_channels = chan;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume, sizeof dip->un.v.units.name);
return 0;
case SB_VOICE_VOL:
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = class;
dip->prev = AUDIO_MIXER_LAST;
dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNdac);
+ strlcpy(dip->label.name, AudioNdac, sizeof dip->label.name);
dip->un.v.num_channels = chan;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume, sizeof dip->un.v.units.name);
return 0;
case SB_OUTPUT_CLASS:
dip->type = AUDIO_MIXER_CLASS;
dip->mixer_class = SB_OUTPUT_CLASS;
dip->next = dip->prev = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCoutputs);
+ strlcpy(dip->label.name, AudioCoutputs, sizeof dip->label.name);
return 0;
}
@@ -1963,9 +1963,10 @@ sbdsp_mixer_query_devinfo(addr, dip)
dip->mixer_class = class;
dip->prev = AUDIO_MIXER_LAST;
dip->next = is1745 ? SB_MIC_IN_MUTE : AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNmicrophone);
+ strlcpy(dip->label.name, AudioNmicrophone,
+ sizeof dip->label.name);
dip->un.v.num_channels = 1;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume, sizeof dip->un.v.units.name);
return 0;
case SB_LINE_IN_VOL:
@@ -1973,72 +1974,86 @@ sbdsp_mixer_query_devinfo(addr, dip)
dip->mixer_class = class;
dip->prev = AUDIO_MIXER_LAST;
dip->next = is1745 ? SB_LINE_IN_MUTE : AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNline);
+ strlcpy(dip->label.name, AudioNline, sizeof dip->label.name);
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume, sizeof dip->un.v.units.name);
return 0;
case SB_RECORD_SOURCE:
dip->mixer_class = SB_RECORD_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNsource);
+ strlcpy(dip->label.name, AudioNsource, sizeof dip->label.name);
if (ISSBM1745(sc)) {
dip->type = AUDIO_MIXER_SET;
dip->un.s.num_mem = 4;
- strcpy(dip->un.s.member[0].label.name, AudioNmicrophone);
+ strlcpy(dip->un.s.member[0].label.name,
+ AudioNmicrophone,
+ sizeof dip->un.s.member[0].label.name);
dip->un.s.member[0].mask = 1 << SB_MIC_VOL;
- strcpy(dip->un.s.member[1].label.name, AudioNcd);
+ strlcpy(dip->un.s.member[1].label.name,
+ AudioNcd, sizeof dip->un.s.member[1].label.name);
dip->un.s.member[1].mask = 1 << SB_CD_VOL;
- strcpy(dip->un.s.member[2].label.name, AudioNline);
+ strlcpy(dip->un.s.member[2].label.name,
+ AudioNline, sizeof dip->un.s.member[2].label.name);
dip->un.s.member[2].mask = 1 << SB_LINE_IN_VOL;
- strcpy(dip->un.s.member[3].label.name, AudioNfmsynth);
+ strlcpy(dip->un.s.member[3].label.name,
+ AudioNfmsynth,
+ sizeof dip->un.s.member[3].label.name);
dip->un.s.member[3].mask = 1 << SB_MIDI_VOL;
} else {
dip->type = AUDIO_MIXER_ENUM;
dip->un.e.num_mem = 3;
- strcpy(dip->un.e.member[0].label.name, AudioNmicrophone);
+ strlcpy(dip->un.e.member[0].label.name,
+ AudioNmicrophone,
+ sizeof dip->un.e.member[0].label.name);
dip->un.e.member[0].ord = SB_MIC_VOL;
- strcpy(dip->un.e.member[1].label.name, AudioNcd);
+ strlcpy(dip->un.e.member[1].label.name, AudioNcd,
+ sizeof dip->un.e.member[1].label.name);
dip->un.e.member[1].ord = SB_CD_VOL;
- strcpy(dip->un.e.member[2].label.name, AudioNline);
+ strlcpy(dip->un.e.member[2].label.name, AudioNline,
+ sizeof dip->un.e.member[2].label.name);
dip->un.e.member[2].ord = SB_LINE_IN_VOL;
}
return 0;
case SB_BASS:
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNbass);
+ strlcpy(dip->label.name, AudioNbass, sizeof dip->label.name);
if (sc->sc_mixer_model == SBM_CT1745) {
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = SB_EQUALIZATION_CLASS;
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNbass);
+ strlcpy(dip->un.v.units.name, AudioNbass, sizeof dip->un.v.units.name);
} else {
dip->type = AUDIO_MIXER_ENUM;
dip->mixer_class = SB_INPUT_CLASS;
dip->un.e.num_mem = 2;
- strcpy(dip->un.e.member[0].label.name, AudioNoff);
+ strlcpy(dip->un.e.member[0].label.name, AudioNoff,
+ sizeof dip->un.e.member[0].label.name);
dip->un.e.member[0].ord = 0;
- strcpy(dip->un.e.member[1].label.name, AudioNon);
+ strlcpy(dip->un.e.member[1].label.name, AudioNon,
+ sizeof dip->un.e.member[1].label.name);
dip->un.e.member[1].ord = 1;
}
return 0;
case SB_TREBLE:
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNtreble);
+ strlcpy(dip->label.name, AudioNtreble, sizeof dip->label.name);
if (sc->sc_mixer_model == SBM_CT1745) {
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = SB_EQUALIZATION_CLASS;
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNtreble);
+ strlcpy(dip->un.v.units.name, AudioNtreble, sizeof dip->un.v.units.name);
} else {
dip->type = AUDIO_MIXER_ENUM;
dip->mixer_class = SB_INPUT_CLASS;
dip->un.e.num_mem = 2;
- strcpy(dip->un.e.member[0].label.name, AudioNoff);
+ strlcpy(dip->un.e.member[0].label.name, AudioNoff,
+ sizeof dip->un.e.member[0].label.name);
dip->un.e.member[0].ord = 0;
- strcpy(dip->un.e.member[1].label.name, AudioNon);
+ strlcpy(dip->un.e.member[1].label.name, AudioNon,
+ sizeof dip->un.e.member[1].label.name);
dip->un.e.member[1].ord = 1;
}
return 0;
@@ -2047,14 +2062,14 @@ sbdsp_mixer_query_devinfo(addr, dip)
dip->type = AUDIO_MIXER_CLASS;
dip->mixer_class = SB_RECORD_CLASS;
dip->next = dip->prev = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCrecord);
+ strlcpy(dip->label.name, AudioCrecord, sizeof dip->label.name);
return 0;
case SB_INPUT_CLASS:
dip->type = AUDIO_MIXER_CLASS;
dip->mixer_class = SB_INPUT_CLASS;
dip->next = dip->prev = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCinputs);
+ strlcpy(dip->label.name, AudioCinputs, sizeof dip->label.name);
return 0;
}
@@ -2067,38 +2082,40 @@ sbdsp_mixer_query_devinfo(addr, dip)
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = SB_INPUT_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, "pc_speaker");
+ strlcpy(dip->label.name, "pc_speaker", sizeof dip->label.name);
dip->un.v.num_channels = 1;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume, sizeof dip->un.v.units.name);
return 0;
case SB_INPUT_GAIN:
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = SB_INPUT_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNinput);
+ strlcpy(dip->label.name, AudioNinput, sizeof dip->label.name);
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume, sizeof dip->un.v.units.name);
return 0;
case SB_OUTPUT_GAIN:
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = SB_OUTPUT_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNoutput);
+ strlcpy(dip->label.name, AudioNoutput, sizeof dip->label.name);
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume, sizeof dip->un.v.units.name);
return 0;
case SB_AGC:
dip->type = AUDIO_MIXER_ENUM;
dip->mixer_class = SB_INPUT_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, "agc");
+ strlcpy(dip->label.name, "agc", sizeof dip->label.name);
dip->un.e.num_mem = 2;
- strcpy(dip->un.e.member[0].label.name, AudioNoff);
+ strlcpy(dip->un.e.member[0].label.name, AudioNoff,
+ sizeof dip->un.e.member[0].label.name);
dip->un.e.member[0].ord = 0;
- strcpy(dip->un.e.member[1].label.name, AudioNon);
+ strlcpy(dip->un.e.member[1].label.name, AudioNon,
+ sizeof dip->un.e.member[1].label.name);
dip->un.e.member[1].ord = 1;
return 0;
@@ -2106,7 +2123,7 @@ sbdsp_mixer_query_devinfo(addr, dip)
dip->type = AUDIO_MIXER_CLASS;
dip->mixer_class = SB_EQUALIZATION_CLASS;
dip->next = dip->prev = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCequalization);
+ strlcpy(dip->label.name, AudioCequalization, sizeof dip->label.name);
return 0;
case SB_CD_IN_MUTE:
@@ -2153,7 +2170,7 @@ sbdsp_mixer_query_devinfo(addr, dip)
dip->next = AUDIO_MIXER_LAST;
swap:
dip->mixer_class = SB_INPUT_CLASS;
- strcpy(dip->label.name, AudioNswap);
+ strlcpy(dip->label.name, AudioNswap, sizeof dip->label.name);
goto mute1;
case SB_CD_OUT_MUTE:
@@ -2173,13 +2190,15 @@ sbdsp_mixer_query_devinfo(addr, dip)
dip->next = AUDIO_MIXER_LAST;
dip->mixer_class = SB_OUTPUT_CLASS;
mute:
- strcpy(dip->label.name, AudioNmute);
+ strlcpy(dip->label.name, AudioNmute, sizeof dip->label.name);
mute1:
dip->type = AUDIO_MIXER_ENUM;
dip->un.e.num_mem = 2;
- strcpy(dip->un.e.member[0].label.name, AudioNoff);
+ strlcpy(dip->un.e.member[0].label.name, AudioNoff,
+ sizeof dip->un.e.member[0].label.name);
dip->un.e.member[0].ord = 0;
- strcpy(dip->un.e.member[1].label.name, AudioNon);
+ strlcpy(dip->un.e.member[1].label.name, AudioNon,
+ sizeof dip->un.e.member[1].label.name);
dip->un.e.member[1].ord = 1;
return 0;