diff options
author | Hakan Olsson <ho@cvs.openbsd.org> | 2003-04-27 11:22:55 +0000 |
---|---|---|
committer | Hakan Olsson <ho@cvs.openbsd.org> | 2003-04-27 11:22:55 +0000 |
commit | c670c56d6bb9915caf18009083d3515283a25fe1 (patch) | |
tree | ffee78ad4ad468acbebd70d511be258d28fdbd52 /sys/dev/isa | |
parent | c9c7d16545b1bfad4519f491aa113a57ab7c7b2d (diff) |
strcpy/sprintf cleanup of sys/dev. miod@, deraadt@ says to commit.
Diffstat (limited to 'sys/dev/isa')
-rw-r--r-- | sys/dev/isa/ad1848.c | 20 | ||||
-rw-r--r-- | sys/dev/isa/aha.c | 16 | ||||
-rw-r--r-- | sys/dev/isa/aria.c | 98 | ||||
-rw-r--r-- | sys/dev/isa/ess.c | 162 | ||||
-rw-r--r-- | sys/dev/isa/gus.c | 140 | ||||
-rw-r--r-- | sys/dev/isa/if_lc_isa.c | 5 | ||||
-rw-r--r-- | sys/dev/isa/isapnp.c | 5 | ||||
-rw-r--r-- | sys/dev/isa/midi_pcppi.c | 4 | ||||
-rw-r--r-- | sys/dev/isa/opl_ess.c | 4 | ||||
-rw-r--r-- | sys/dev/isa/opl_sb.c | 4 | ||||
-rw-r--r-- | sys/dev/isa/pas.c | 8 | ||||
-rw-r--r-- | sys/dev/isa/pss.c | 82 | ||||
-rw-r--r-- | sys/dev/isa/sb.c | 14 | ||||
-rw-r--r-- | sys/dev/isa/sb_isa.c | 4 | ||||
-rw-r--r-- | sys/dev/isa/sbdsp.c | 127 | ||||
-rw-r--r-- | sys/dev/isa/wss.c | 47 | ||||
-rw-r--r-- | sys/dev/isa/ym.c | 79 |
17 files changed, 484 insertions, 335 deletions
diff --git a/sys/dev/isa/ad1848.c b/sys/dev/isa/ad1848.c index da25e4d1e73..0adb6cd76d2 100644 --- a/sys/dev/isa/ad1848.c +++ b/sys/dev/isa/ad1848.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ad1848.c,v 1.27 2003/02/11 19:20:27 mickey Exp $ */ +/* $OpenBSD: ad1848.c,v 1.28 2003/04/27 11:22:53 ho Exp $ */ /* $NetBSD: ad1848.c,v 1.45 1998/01/30 02:02:38 augustss Exp $ */ /* @@ -943,32 +943,32 @@ ad1848_query_encoding(addr, fp) switch (fp->index) { case 0: - strcpy(fp->name, AudioEmulaw); + strlcpy(fp->name, AudioEmulaw, sizeof fp->name); fp->encoding = AUDIO_ENCODING_ULAW; fp->precision = 8; fp->flags = 0; break; case 1: - strcpy(fp->name, AudioEalaw); + strlcpy(fp->name, AudioEalaw, sizeof fp->name); fp->encoding = AUDIO_ENCODING_ALAW; fp->precision = 8; fp->flags = 0; break; case 2: - 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; break; case 3: - strcpy(fp->name, AudioEulinear); + strlcpy(fp->name, AudioEulinear, sizeof fp->name); fp->encoding = AUDIO_ENCODING_ULINEAR; fp->precision = 8; fp->flags = 0; break; case 4: /* only on CS4231 */ - strcpy(fp->name, AudioEslinear_be); + strlcpy(fp->name, AudioEslinear_be, sizeof fp->name); fp->encoding = AUDIO_ENCODING_SLINEAR_BE; fp->precision = 16; fp->flags = sc->mode == 1 ? AUDIO_ENCODINGFLAG_EMULATED : 0; @@ -976,19 +976,19 @@ ad1848_query_encoding(addr, fp) /* emulate some modes */ case 5: - strcpy(fp->name, AudioEslinear); + strlcpy(fp->name, AudioEslinear, sizeof fp->name); fp->encoding = AUDIO_ENCODING_SLINEAR; fp->precision = 8; fp->flags = AUDIO_ENCODINGFLAG_EMULATED; break; case 6: - strcpy(fp->name, AudioEulinear_le); + strlcpy(fp->name, AudioEulinear_le, sizeof fp->name); fp->encoding = AUDIO_ENCODING_ULINEAR_LE; fp->precision = 16; fp->flags = AUDIO_ENCODINGFLAG_EMULATED; break; 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; @@ -997,7 +997,7 @@ ad1848_query_encoding(addr, fp) case 8: /* only on CS4231 */ if (sc->mode == 1) return EINVAL; - strcpy(fp->name, AudioEadpcm); + strlcpy(fp->name, AudioEadpcm, sizeof fp->name); fp->encoding = AUDIO_ENCODING_ADPCM; fp->precision = 8; fp->flags = 0; diff --git a/sys/dev/isa/aha.c b/sys/dev/isa/aha.c index e8236973c6e..8b288c9cbc4 100644 --- a/sys/dev/isa/aha.c +++ b/sys/dev/isa/aha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aha.c,v 1.50 2003/04/10 10:11:24 miod Exp $ */ +/* $OpenBSD: aha.c,v 1.51 2003/04/27 11:22:53 ho Exp $ */ /* $NetBSD: aha.c,v 1.11 1996/05/12 23:51:23 mycroft Exp $ */ #undef AHADIAG @@ -1162,7 +1162,7 @@ aha_inquire_setup_information(sc) int i; char *p; - strcpy(sc->sc_model, "unknown"); + strlcpy(sc->sc_model, "unknown", sizeof sc->sc_model); /* * Assume we have a board at this stage, do an adapter inquire @@ -1204,23 +1204,23 @@ aha_inquire_setup_information(sc) switch (revision.reply.boardid) { case 0x31: - strcpy(sc->sc_model, "1540"); + strlcpy(sc->sc_model, "1540", sizeof sc->sc_model); break; case 0x41: - strcpy(sc->sc_model, "1540A/1542A/1542B"); + strlcpy(sc->sc_model, "1540A/1542A/1542B", sizeof sc->sc_model); break; case 0x42: - strcpy(sc->sc_model, "1640"); + strlcpy(sc->sc_model, "1640", sizeof sc->sc_model); break; case 0x43: case 0x44: /* Is this 1542C or -CF? */ - strcpy(sc->sc_model, "1542C"); + strlcpy(sc->sc_model, "1542C", sizeof sc->sc_model); break; case 0x45: - strcpy(sc->sc_model, "1542CF"); + strlcpy(sc->sc_model, "1542CF", sizeof sc->sc_model); break; case 0x46: - strcpy(sc->sc_model, "1542CP"); + strlcpy(sc->sc_model, "1542CP", sizeof sc->sc_model); break; } diff --git a/sys/dev/isa/aria.c b/sys/dev/isa/aria.c index ad23c43ea8c..ad09545920d 100644 --- a/sys/dev/isa/aria.c +++ b/sys/dev/isa/aria.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aria.c,v 1.8 2002/03/14 03:16:05 millert Exp $ */ +/* $OpenBSD: aria.c,v 1.9 2003/04/27 11:22:53 ho Exp $ */ /* * Copyright (c) 1995, 1996 Roland C. Dowdeswell. All rights reserved. @@ -469,7 +469,8 @@ ariaattach(parent, self, aux) printf(", SC18075 mixer"); printf("\n"); - sprintf(aria_device.version, "%s", (ARIA_MODEL&sc->sc_hardware?"SC18026":"SC18025")); + snprintf(aria_device.version, sizeof aria_device.version, "%s", + (ARIA_MODEL&sc->sc_hardware?"SC18026":"SC18025")); if ((err = audio_hardware_attach(&aria_hw_if, sc)) != 0) printf("aria: could not attach to audio pseudo-device driver (%d)\n", err); @@ -582,11 +583,11 @@ aria_query_encoding(addr, fp) switch (fp->index) { case 0: - strcpy(fp->name, AudioEmulaw); + strlcpy(fp->name, AudioEmulaw, sizeof fp->name); fp->format_id = AUDIO_ENCODING_ULAW; break; case 1: - strcpy(fp->name, AudioEpcm16); + strlcpy(fp->name, AudioEpcm16, sizeof fp->name); fp->format_id = AUDIO_ENCODING_PCM16; break; default: @@ -1542,54 +1543,61 @@ aria_mixer_query_devinfo(addr, dip) dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = ARIAMIX_INPUT_CLASS; dip->next = ARIAMIX_MIC_MUTE; - strcpy(dip->label.name, AudioNmicrophone); + strlcpy(dip->label.name, AudioNmicrophone, + 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); break; case ARIAMIX_LINE_IN_LVL: dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = ARIAMIX_INPUT_CLASS; dip->next = ARIAMIX_LINE_IN_MUTE; - 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); break; case ARIAMIX_CD_LVL: dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = ARIAMIX_INPUT_CLASS; dip->next = ARIAMIX_CD_MUTE; - strcpy(dip->label.name, AudioNcd); + strlcpy(dip->label.name, AudioNcd, 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); break; case ARIAMIX_TEL_LVL: dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = ARIAMIX_INPUT_CLASS; dip->next = ARIAMIX_TEL_MUTE; - strcpy(dip->label.name, "telephone"); + strlcpy(dip->label.name, "telephone", 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); break; case ARIAMIX_DAC_LVL: dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = ARIAMIX_INPUT_CLASS; dip->next = ARIAMIX_DAC_MUTE; - strcpy(dip->label.name, AudioNdac); + strlcpy(dip->label.name, AudioNdac, 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); break; case ARIAMIX_AUX_LVL: dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = ARIAMIX_INPUT_CLASS; dip->next = ARIAMIX_AUX_MUTE; - strcpy(dip->label.name, AudioNoutput); + strlcpy(dip->label.name, AudioNoutput, 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); break; case ARIAMIX_MIC_MUTE: @@ -1619,11 +1627,13 @@ aria_mixer_query_devinfo(addr, dip) mode: dip->mixer_class = ARIAMIX_INPUT_CLASS; dip->type = AUDIO_MIXER_ENUM; - strcpy(dip->label.name, AudioNmute); + strlcpy(dip->label.name, AudioNmute, 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[0].label.name); dip->un.e.member[1].ord = 1; break; @@ -1631,9 +1641,10 @@ mode: dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = ARIAMIX_OUTPUT_CLASS; dip->next = ARIAMIX_MASTER_TREBLE; - strcpy(dip->label.name, AudioNvolume); + strlcpy(dip->label.name, AudioNvolume, 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); break; case ARIAMIX_MASTER_TREBLE: @@ -1641,69 +1652,80 @@ mode: dip->mixer_class = ARIAMIX_OUTPUT_CLASS; dip->prev = ARIAMIX_MASTER_LVL; dip->next = ARIAMIX_MASTER_BASS; - strcpy(dip->label.name, AudioNmaster); + strlcpy(dip->label.name, AudioNmaster, sizeof dip->label.name); 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); break; case ARIAMIX_MASTER_BASS: dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = ARIAMIX_OUTPUT_CLASS; dip->prev = ARIAMIX_MASTER_TREBLE; - strcpy(dip->label.name, AudioNmaster); + strlcpy(dip->label.name, AudioNmaster, sizeof dip->label.name); 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); break; case ARIAMIX_OUT_LVL: dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = ARIAMIX_OUTPUT_CLASS; - 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); break; case ARIAMIX_RECORD_SOURCE: dip->mixer_class = ARIAMIX_RECORD_CLASS; dip->type = AUDIO_MIXER_ENUM; - strcpy(dip->label.name, AudioNsource); + strlcpy(dip->label.name, AudioNsource, sizeof dip->label.name); dip->un.e.num_mem = 6; - strcpy(dip->un.e.member[0].label.name, AudioNoutput); + strlcpy(dip->un.e.member[0].label.name, AudioNoutput, + sizeof dip->un.e.member[0].label.name); dip->un.e.member[0].ord = ARIAMIX_AUX_LVL; - strcpy(dip->un.e.member[1].label.name, AudioNmicrophone); + strlcpy(dip->un.e.member[1].label.name, AudioNmicrophone, + sizeof dip->un.e.member[0].label.name); dip->un.e.member[1].ord = ARIAMIX_MIC_LVL; - strcpy(dip->un.e.member[2].label.name, AudioNdac); + strlcpy(dip->un.e.member[2].label.name, AudioNdac, + sizeof dip->un.e.member[0].label.name); dip->un.e.member[2].ord = ARIAMIX_DAC_LVL; - strcpy(dip->un.e.member[3].label.name, AudioNline); + strlcpy(dip->un.e.member[3].label.name, AudioNline, + sizeof dip->un.e.member[0].label.name); dip->un.e.member[3].ord = ARIAMIX_LINE_IN_LVL; - strcpy(dip->un.e.member[3].label.name, AudioNcd); + strlcpy(dip->un.e.member[3].label.name, AudioNcd, + sizeof dip->un.e.member[0].label.name); dip->un.e.member[4].ord = ARIAMIX_CD_LVL; - strcpy(dip->un.e.member[3].label.name, "telephone"); + strlcpy(dip->un.e.member[3].label.name, "telephone", + sizeof dip->un.e.member[0].label.name); dip->un.e.member[5].ord = ARIAMIX_TEL_LVL; break; case ARIAMIX_INPUT_CLASS: dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = ARIAMIX_INPUT_CLASS; - strcpy(dip->label.name, AudioCInputs); + strlcpy(dip->label.name, AudioCInputs, sizeof dip->label.name); break; case ARIAMIX_OUTPUT_CLASS: dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = ARIAMIX_OUTPUT_CLASS; - strcpy(dip->label.name, AudioCOutputs); + strlcpy(dip->label.name, AudioCOutputs, + sizeof dip->label.name); break; case ARIAMIX_RECORD_CLASS: dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = ARIAMIX_RECORD_CLASS; - strcpy(dip->label.name, AudioCRecord); + strlcpy(dip->label.name, AudioCRecord, sizeof dip->label.name); break; case ARIAMIX_EQ_CLASS: dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = ARIAMIX_EQ_CLASS; - strcpy(dip->label.name, AudioCEqualization); + strlcpy(dip->label.name, AudioCEqualization, + sizeof dip->label.name); break; default: diff --git a/sys/dev/isa/ess.c b/sys/dev/isa/ess.c index 69b4a903f3f..64ce29bce11 100644 --- a/sys/dev/isa/ess.c +++ b/sys/dev/isa/ess.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ess.c,v 1.8 2002/03/14 03:16:05 millert Exp $ */ +/* $OpenBSD: ess.c,v 1.9 2003/04/27 11:22:53 ho Exp $ */ /* $NetBSD: ess.c,v 1.44.4.1 1999/06/21 01:18:00 thorpej Exp $ */ /* @@ -1005,8 +1005,10 @@ essattach(sc) ess_speaker_off(sc); sc->spkr_state = SPKR_OFF; - sprintf(ess_device.name, "ES%s", essmodel[sc->sc_model]); - sprintf(ess_device.version, "0x%04x", sc->sc_version); + snprintf(ess_device.name, sizeof ess_device.name, "ES%s", + essmodel[sc->sc_model]); + snprintf(ess_device.version, sizeof ess_device.name, "0x%04x", + sc->sc_version); if (ESS_USE_AUDIO1(sc->sc_model)) audio_attach_mi(&ess_1788_hw_if, sc, &sc->sc_dev); @@ -1133,49 +1135,49 @@ ess_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 = 0; return (0); 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 = 0; 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; @@ -1916,10 +1918,11 @@ ess_query_devinfo(addr, dip) case ESS_DAC_PLAY_VOL: dip->mixer_class = ESS_INPUT_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNdac); + strlcpy(dip->label.name, AudioNdac, sizeof dip->label.name); dip->type = AUDIO_MIXER_VALUE; 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 ESS_MIC_PLAY_VOL: @@ -1929,93 +1932,103 @@ ess_query_devinfo(addr, dip) dip->next = AUDIO_MIXER_LAST; else dip->next = ESS_MIC_PREAMP; - strcpy(dip->label.name, AudioNmicrophone); + strlcpy(dip->label.name, AudioNmicrophone, + sizeof dip->label.name); dip->type = AUDIO_MIXER_VALUE; 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 ESS_LINE_PLAY_VOL: dip->mixer_class = ESS_INPUT_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNline); + strlcpy(dip->label.name, AudioNline, sizeof dip->label.name); dip->type = AUDIO_MIXER_VALUE; 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 ESS_SYNTH_PLAY_VOL: dip->mixer_class = ESS_INPUT_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNfmsynth); + strlcpy(dip->label.name, AudioNfmsynth, + sizeof dip->label.name); dip->type = AUDIO_MIXER_VALUE; 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 ESS_CD_PLAY_VOL: dip->mixer_class = ESS_INPUT_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNcd); + strlcpy(dip->label.name, AudioNcd, sizeof dip->label.name); dip->type = AUDIO_MIXER_VALUE; 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 ESS_AUXB_PLAY_VOL: dip->mixer_class = ESS_INPUT_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, "auxb"); + strlcpy(dip->label.name, "auxb", sizeof dip->label.name); dip->type = AUDIO_MIXER_VALUE; 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 ESS_INPUT_CLASS: dip->mixer_class = ESS_INPUT_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioCinputs); + strlcpy(dip->label.name, AudioCinputs, sizeof dip->label.name); dip->type = AUDIO_MIXER_CLASS; return (0); case ESS_MASTER_VOL: dip->mixer_class = ESS_OUTPUT_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNmaster); + strlcpy(dip->label.name, AudioNmaster, sizeof dip->label.name); dip->type = AUDIO_MIXER_VALUE; 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 ESS_PCSPEAKER_VOL: dip->mixer_class = ESS_OUTPUT_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, "pc_speaker"); + strlcpy(dip->label.name, "pc_speaker", sizeof dip->label.name); dip->type = AUDIO_MIXER_VALUE; 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 ESS_OUTPUT_CLASS: dip->mixer_class = ESS_OUTPUT_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioCoutputs); + strlcpy(dip->label.name, AudioCoutputs, sizeof dip->label.name); dip->type = AUDIO_MIXER_CLASS; return (0); case ESS_RECORD_VOL: dip->mixer_class = ESS_RECORD_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNrecord); + strlcpy(dip->label.name, AudioNrecord, sizeof dip->label.name); dip->type = AUDIO_MIXER_VALUE; 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 ESS_RECORD_SOURCE: dip->mixer_class = ESS_RECORD_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNsource); + strlcpy(dip->label.name, AudioNsource, sizeof dip->label.name); if (ESS_USE_AUDIO1(sc->sc_model)) { /* * The 1788 doesn't use the input mixer control that @@ -2028,28 +2041,40 @@ ess_query_devinfo(addr, dip) */ dip->type = AUDIO_MIXER_ENUM; dip->un.e.num_mem = 4; - 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 = ESS_SOURCE_MIC; - strcpy(dip->un.e.member[1].label.name, AudioNline); + strlcpy(dip->un.e.member[1].label.name, AudioNline, + sizeof dip->un.e.member[1].label.name); dip->un.e.member[1].ord = ESS_SOURCE_LINE; - strcpy(dip->un.e.member[2].label.name, AudioNcd); + strlcpy(dip->un.e.member[2].label.name, AudioNcd, + sizeof dip->un.e.member[2].label.name); dip->un.e.member[2].ord = ESS_SOURCE_CD; - strcpy(dip->un.e.member[3].label.name, AudioNmixerout); + strlcpy(dip->un.e.member[3].label.name, AudioNmixerout, + sizeof dip->un.e.member[3].label.name); dip->un.e.member[3].ord = ESS_SOURCE_MIXER; } else { dip->type = AUDIO_MIXER_SET; dip->un.s.num_mem = 6; - strcpy(dip->un.s.member[0].label.name, AudioNdac); + strlcpy(dip->un.s.member[0].label.name, AudioNdac, + sizeof dip->un.e.member[0].label.name); dip->un.s.member[0].mask = 1 << ESS_DAC_REC_VOL; - strcpy(dip->un.s.member[1].label.name, AudioNmicrophone); + strlcpy(dip->un.s.member[1].label.name, + AudioNmicrophone, + sizeof dip->un.e.member[1].label.name); dip->un.s.member[1].mask = 1 << ESS_MIC_REC_VOL; - strcpy(dip->un.s.member[2].label.name, AudioNline); + strlcpy(dip->un.s.member[2].label.name, AudioNline, + sizeof dip->un.e.member[2].label.name); dip->un.s.member[2].mask = 1 << ESS_LINE_REC_VOL; - strcpy(dip->un.s.member[3].label.name, AudioNfmsynth); + strlcpy(dip->un.s.member[3].label.name, AudioNfmsynth, + sizeof dip->un.e.member[3].label.name); dip->un.s.member[3].mask = 1 << ESS_SYNTH_REC_VOL; - strcpy(dip->un.s.member[4].label.name, AudioNcd); + strlcpy(dip->un.s.member[4].label.name, AudioNcd, + sizeof dip->un.e.member[4].label.name); dip->un.s.member[4].mask = 1 << ESS_CD_REC_VOL; - strcpy(dip->un.s.member[5].label.name, "auxb"); + strlcpy(dip->un.s.member[5].label.name, "auxb", + sizeof dip->un.e.member[5].label.name); dip->un.s.member[5].mask = 1 << ESS_AUXB_REC_VOL; } return (0); @@ -2057,26 +2082,29 @@ ess_query_devinfo(addr, dip) case ESS_RECORD_CLASS: dip->mixer_class = ESS_RECORD_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioCrecord); + strlcpy(dip->label.name, AudioCrecord, sizeof dip->label.name); dip->type = AUDIO_MIXER_CLASS; return (0); case ESS_RECORD_MONITOR: dip->prev = dip->next = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNmute); + strlcpy(dip->label.name, AudioNmute, sizeof dip->label.name); dip->type = AUDIO_MIXER_ENUM; dip->mixer_class = ESS_MONITOR_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 ESS_MONITOR_CLASS: dip->mixer_class = ESS_MONITOR_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioCmonitor); + strlcpy(dip->label.name, AudioCmonitor, + sizeof dip->label.name); dip->type = AUDIO_MIXER_CLASS; return (0); } @@ -2088,67 +2116,77 @@ ess_query_devinfo(addr, dip) case ESS_DAC_REC_VOL: dip->mixer_class = ESS_RECORD_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNdac); + strlcpy(dip->label.name, AudioNdac, sizeof dip->label.name); dip->type = AUDIO_MIXER_VALUE; 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 ESS_MIC_REC_VOL: dip->mixer_class = ESS_RECORD_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNmicrophone); + strlcpy(dip->label.name, AudioNmicrophone, + sizeof dip->label.name); dip->type = AUDIO_MIXER_VALUE; 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 ESS_LINE_REC_VOL: dip->mixer_class = ESS_RECORD_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNline); + strlcpy(dip->label.name, AudioNline, sizeof dip->label.name); dip->type = AUDIO_MIXER_VALUE; 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 ESS_SYNTH_REC_VOL: dip->mixer_class = ESS_RECORD_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNfmsynth); + strlcpy(dip->label.name, AudioNfmsynth, + sizeof dip->label.name); dip->type = AUDIO_MIXER_VALUE; 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 ESS_CD_REC_VOL: dip->mixer_class = ESS_RECORD_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNcd); + strlcpy(dip->label.name, AudioNcd, sizeof dip->label.name); dip->type = AUDIO_MIXER_VALUE; 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 ESS_AUXB_REC_VOL: dip->mixer_class = ESS_RECORD_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, "auxb"); + strlcpy(dip->label.name, "auxb", sizeof dip->label.name); dip->type = AUDIO_MIXER_VALUE; 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 ESS_MIC_PREAMP: dip->mixer_class = ESS_INPUT_CLASS; dip->prev = ESS_MIC_PLAY_VOL; dip->next = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNpreamp); + strlcpy(dip->label.name, AudioNpreamp, sizeof dip->label.name); 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); } diff --git a/sys/dev/isa/gus.c b/sys/dev/isa/gus.c index b440b140d41..a42d77f696a 100644 --- a/sys/dev/isa/gus.c +++ b/sys/dev/isa/gus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gus.c,v 1.24 2002/03/14 01:26:56 millert Exp $ */ +/* $OpenBSD: gus.c,v 1.25 2003/04/27 11:22:53 ho Exp $ */ /* $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */ /*- @@ -2903,9 +2903,10 @@ gusmax_mixer_query_devinfo(addr, dip) dip->mixer_class = GUSMAX_INPUT_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = GUSMAX_MIC_IN_MUTE; - strcpy(dip->label.name, AudioNmicrophone); + strlcpy(dip->label.name, AudioNmicrophone, 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); break; #endif @@ -2914,9 +2915,10 @@ gusmax_mixer_query_devinfo(addr, dip) dip->mixer_class = GUSMAX_INPUT_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = GUSMAX_MONO_MUTE; - 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); break; case GUSMAX_DAC_LVL: /* dacout */ @@ -2924,9 +2926,10 @@ gusmax_mixer_query_devinfo(addr, dip) dip->mixer_class = GUSMAX_INPUT_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = GUSMAX_DAC_MUTE; - strcpy(dip->label.name, AudioNdac); + strlcpy(dip->label.name, AudioNdac, 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); break; case GUSMAX_LINE_IN_LVL: /* line */ @@ -2934,9 +2937,10 @@ gusmax_mixer_query_devinfo(addr, dip) dip->mixer_class = GUSMAX_INPUT_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = GUSMAX_LINE_IN_MUTE; - 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); break; case GUSMAX_CD_LVL: /* cd */ @@ -2944,9 +2948,10 @@ gusmax_mixer_query_devinfo(addr, dip) dip->mixer_class = GUSMAX_INPUT_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = GUSMAX_CD_MUTE; - strcpy(dip->label.name, AudioNcd); + strlcpy(dip->label.name, AudioNcd, 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); break; @@ -2955,18 +2960,20 @@ gusmax_mixer_query_devinfo(addr, dip) dip->mixer_class = GUSMAX_MONITOR_CLASS; dip->next = GUSMAX_MONITOR_MUTE; dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNmonitor); + strlcpy(dip->label.name, AudioNmonitor, 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); break; case GUSMAX_OUT_LVL: /* cs4231 output volume: not useful? */ dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = GUSMAX_MONITOR_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); break; case GUSMAX_SPEAKER_LVL: /* fake speaker volume */ @@ -2974,9 +2981,10 @@ gusmax_mixer_query_devinfo(addr, dip) dip->mixer_class = GUSMAX_MONITOR_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = GUSMAX_SPEAKER_MUTE; - strcpy(dip->label.name, AudioNmaster); + strlcpy(dip->label.name, AudioNmaster, 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); break; case GUSMAX_LINE_IN_MUTE: @@ -3020,11 +3028,13 @@ gusmax_mixer_query_devinfo(addr, dip) dip->prev = GUSMAX_SPEAKER_LVL; dip->next = AUDIO_MIXER_LAST; mute: - strcpy(dip->label.name, AudioNmute); + strlcpy(dip->label.name, AudioNmute, 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; break; @@ -3033,9 +3043,9 @@ gusmax_mixer_query_devinfo(addr, dip) dip->mixer_class = GUSMAX_RECORD_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = GUSMAX_RECORD_SOURCE; - strcpy(dip->label.name, AudioNrecord); + strlcpy(dip->label.name, AudioNrecord, 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); break; case GUSMAX_RECORD_SOURCE: @@ -3043,15 +3053,19 @@ gusmax_mixer_query_devinfo(addr, dip) dip->type = AUDIO_MIXER_ENUM; dip->prev = GUSMAX_REC_LVL; dip->next = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNsource); + strlcpy(dip->label.name, AudioNsource, sizeof dip->label.name); dip->un.e.num_mem = 4; - strcpy(dip->un.e.member[0].label.name, AudioNoutput); + strlcpy(dip->un.e.member[0].label.name, AudioNoutput, + sizeof dip->un.e.member[0].label.name); dip->un.e.member[0].ord = DAC_IN_PORT; - strcpy(dip->un.e.member[1].label.name, AudioNmicrophone); + strlcpy(dip->un.e.member[1].label.name, AudioNmicrophone, + sizeof dip->un.e.member[1].label.name); dip->un.e.member[1].ord = MIC_IN_PORT; - strcpy(dip->un.e.member[2].label.name, AudioNdac); + strlcpy(dip->un.e.member[2].label.name, AudioNdac, + sizeof dip->un.e.member[2].label.name); dip->un.e.member[2].ord = AUX1_IN_PORT; - strcpy(dip->un.e.member[3].label.name, AudioNline); + strlcpy(dip->un.e.member[3].label.name, AudioNline, + sizeof dip->un.e.member[3].label.name); dip->un.e.member[3].ord = LINE_IN_PORT; break; @@ -3059,28 +3073,28 @@ gusmax_mixer_query_devinfo(addr, dip) dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = GUSMAX_INPUT_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioCinputs); + strlcpy(dip->label.name, AudioCinputs, sizeof dip->label.name); break; case GUSMAX_OUTPUT_CLASS: /* output class descriptor */ dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = GUSMAX_OUTPUT_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioCoutputs); + strlcpy(dip->label.name, AudioCoutputs, sizeof dip->label.name); break; case GUSMAX_MONITOR_CLASS: /* monitor class descriptor */ dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = GUSMAX_MONITOR_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioCmonitor); + strlcpy(dip->label.name, AudioCmonitor, sizeof dip->label.name); break; case GUSMAX_RECORD_CLASS: /* record source class */ dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = GUSMAX_RECORD_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioCrecord); + strlcpy(dip->label.name, AudioCrecord, sizeof dip->label.name); break; default: @@ -3110,9 +3124,11 @@ gus_mixer_query_devinfo(addr, dip) dip->mixer_class = GUSICS_INPUT_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = GUSICS_MIC_IN_MUTE; - strcpy(dip->label.name, AudioNmicrophone); + strlcpy(dip->label.name, AudioNmicrophone, + 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); break; case GUSICS_LINE_IN_LVL: /* line */ @@ -3120,9 +3136,10 @@ gus_mixer_query_devinfo(addr, dip) dip->mixer_class = GUSICS_INPUT_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = GUSICS_LINE_IN_MUTE; - 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); break; case GUSICS_CD_LVL: /* cd */ @@ -3130,9 +3147,10 @@ gus_mixer_query_devinfo(addr, dip) dip->mixer_class = GUSICS_INPUT_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = GUSICS_CD_MUTE; - strcpy(dip->label.name, AudioNcd); + strlcpy(dip->label.name, AudioNcd, 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); break; case GUSICS_DAC_LVL: /* dacout */ @@ -3140,9 +3158,10 @@ gus_mixer_query_devinfo(addr, dip) dip->mixer_class = GUSICS_INPUT_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = GUSICS_DAC_MUTE; - strcpy(dip->label.name, AudioNdac); + strlcpy(dip->label.name, AudioNdac, 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); break; case GUSICS_MASTER_LVL: /* master output */ @@ -3150,9 +3169,10 @@ gus_mixer_query_devinfo(addr, dip) dip->mixer_class = GUSICS_OUTPUT_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = GUSICS_MASTER_MUTE; - strcpy(dip->label.name, AudioNmaster); + strlcpy(dip->label.name, AudioNmaster, 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); break; @@ -3190,11 +3210,13 @@ gus_mixer_query_devinfo(addr, dip) dip->prev = GUSICS_MASTER_LVL; dip->next = AUDIO_MIXER_LAST; mute: - strcpy(dip->label.name, AudioNmute); + strlcpy(dip->label.name, AudioNmute, 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; break; @@ -3202,9 +3224,10 @@ mute: dip->mixer_class = GUSICS_RECORD_CLASS; dip->type = AUDIO_MIXER_ENUM; dip->prev = dip->next = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNsource); + strlcpy(dip->label.name, AudioNsource, sizeof dip->label.name); dip->un.e.num_mem = 1; - strcpy(dip->un.e.member[0].label.name, AudioNoutput); + strlcpy(dip->un.e.member[0].label.name, AudioNoutput, + sizeof dip->un.e.member[0].label.name); dip->un.e.member[0].ord = GUSICS_MASTER_LVL; break; @@ -3212,21 +3235,21 @@ mute: dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = GUSICS_INPUT_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioCinputs); + strlcpy(dip->label.name, AudioCinputs, sizeof dip->label.name); break; case GUSICS_OUTPUT_CLASS: dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = GUSICS_OUTPUT_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioCoutputs); + strlcpy(dip->label.name, AudioCoutputs, sizeof dip->label.name); break; case GUSICS_RECORD_CLASS: dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = GUSICS_RECORD_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioCrecord); + strlcpy(dip->label.name, AudioCrecord, sizeof dip->label.name); break; default: @@ -3244,49 +3267,49 @@ gus_query_encoding(addr, fp) { switch (fp->index) { case 0: - strcpy(fp->name, AudioEmulaw); + strlcpy(fp->name, AudioEmulaw, sizeof fp->name); fp->encoding = AUDIO_ENCODING_ULAW; fp->precision = 8; fp->flags = AUDIO_ENCODINGFLAG_EMULATED; break; case 1: - strcpy(fp->name, AudioEslinear); + strlcpy(fp->name, AudioEslinear, sizeof fp->name); fp->encoding = AUDIO_ENCODING_SLINEAR; fp->precision = 8; fp->flags = 0; break; case 2: - 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; break; case 3: - strcpy(fp->name, AudioEulinear); + strlcpy(fp->name, AudioEulinear, sizeof fp->name); fp->encoding = AUDIO_ENCODING_ULINEAR; fp->precision = 8; fp->flags = 0; break; case 4: - strcpy(fp->name, AudioEulinear_le); + strlcpy(fp->name, AudioEulinear_le, sizeof fp->name); fp->encoding = AUDIO_ENCODING_ULINEAR_LE; fp->precision = 16; fp->flags = 0; break; case 5: - 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; break; case 6: - 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; break; case 7: - strcpy(fp->name, AudioEalaw); + strlcpy(fp->name, AudioEalaw, sizeof fp->name); fp->encoding = AUDIO_ENCODING_ALAW; fp->precision = 8; fp->flags = AUDIO_ENCODINGFLAG_EMULATED; @@ -3528,7 +3551,8 @@ gus_subattach(sc, ia) } sc->sc_dsize = i; - sprintf(gus_device.version, "3.%d", sc->sc_revision); + snprintf(gus_device.version, sizeof gus_device.version, "3.%d", + sc->sc_revision); printf(": ver 3.%d, %dKB DRAM, ", sc->sc_revision, sc->sc_dsize); diff --git a/sys/dev/isa/if_lc_isa.c b/sys/dev/isa/if_lc_isa.c index b87a2155b41..db5fa49456f 100644 --- a/sys/dev/isa/if_lc_isa.c +++ b/sys/dev/isa/if_lc_isa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lc_isa.c,v 1.2 2002/03/14 01:26:56 millert Exp $ */ +/* $OpenBSD: if_lc_isa.c,v 1.3 2003/04/27 11:22:53 ho Exp $ */ /* $NetBSD: if_lc_isa.c,v 1.10 2001/06/13 10:46:03 wiz Exp $ */ /*- @@ -197,7 +197,8 @@ lemac_isa_probe(parent, match, aux) struct cfdata *cf = match; struct lemac_softc sc; - sprintf(sc.sc_dv.dv_xname, "%s%d", lc_cd.cd_name, cf->cf_unit); + snprintf(sc.sc_dv.dv_xname, sizeof sc.sc_dv.dv_xname, "%s%d", + lc_cd.cd_name, cf->cf_unit); return (lemac_isa_find(&sc, ia, 0)); } diff --git a/sys/dev/isa/isapnp.c b/sys/dev/isa/isapnp.c index 9363a402c38..3768317b4f7 100644 --- a/sys/dev/isa/isapnp.c +++ b/sys/dev/isa/isapnp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isapnp.c,v 1.34 2002/07/07 18:20:00 miod Exp $ */ +/* $OpenBSD: isapnp.c,v 1.35 2003/04/27 11:22:53 ho Exp $ */ /* $NetBSD: isapnp.c,v 1.9.4.3 1997/10/29 00:40:43 thorpej Exp $ */ /* @@ -862,7 +862,8 @@ isapnp_match(parent, match, aux) sc.sc_iot = ia->ia_iot; sc.sc_ncards = 0; - (void) strcpy(sc.sc_dev.dv_xname, "(isapnp probe)"); + (void) strlcpy(sc.sc_dev.dv_xname, "(isapnp probe)", + sizeof sc.sc_dev.dv_xname); if (isapnp_map(&sc)) return 0; diff --git a/sys/dev/isa/midi_pcppi.c b/sys/dev/isa/midi_pcppi.c index 394085a3d4f..ed303aef605 100644 --- a/sys/dev/isa/midi_pcppi.c +++ b/sys/dev/isa/midi_pcppi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: midi_pcppi.c,v 1.2 2002/03/14 01:26:56 millert Exp $ */ +/* $OpenBSD: midi_pcppi.c,v 1.3 2003/04/27 11:22:53 ho Exp $ */ /* $NetBSD: midi_pcppi.c,v 1.4 1998/11/25 22:17:06 augustss Exp $ */ /* @@ -121,7 +121,7 @@ midi_pcppi_attach(parent, self, aux) ms = &sc->sc_midisyn; ms->mets = &midi_pcppi_hw; - strcpy(ms->name, "PC speaker"); + strlcpy(ms->name, "PC speaker", sizeof ms->name); ms->nvoice = 1; ms->flags = MS_DOALLOC | MS_FREQXLATE; ms->data = pa->pa_cookie; diff --git a/sys/dev/isa/opl_ess.c b/sys/dev/isa/opl_ess.c index f395b953852..aadb1665631 100644 --- a/sys/dev/isa/opl_ess.c +++ b/sys/dev/isa/opl_ess.c @@ -1,4 +1,4 @@ -/* $OpenBSD: opl_ess.c,v 1.2 2002/03/14 01:26:56 millert Exp $ */ +/* $OpenBSD: opl_ess.c,v 1.3 2003/04/27 11:22:53 ho Exp $ */ /* $NetBSD: opl_ess.c,v 1.3 1998/12/08 14:26:57 augustss Exp $ */ /* @@ -99,7 +99,7 @@ opl_ess_attach(parent, self, aux) sc->offs = 0; sc->spkrctl = ess_speaker_ctl; sc->spkrarg = ssc; - strcpy(sc->syn.name, "ESS "); + strlcpy(sc->syn.name, "ESS ", sizeof sc->syn.name); opl_attach(sc); } diff --git a/sys/dev/isa/opl_sb.c b/sys/dev/isa/opl_sb.c index 0e69cceff8c..d817c6b71be 100644 --- a/sys/dev/isa/opl_sb.c +++ b/sys/dev/isa/opl_sb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: opl_sb.c,v 1.2 2002/03/14 01:26:56 millert Exp $ */ +/* $OpenBSD: opl_sb.c,v 1.3 2003/04/27 11:22:53 ho Exp $ */ /* $NetBSD: opl_sb.c,v 1.4 1998/12/08 14:26:57 augustss Exp $ */ /* @@ -107,7 +107,7 @@ opl_sb_attach(parent, self, aux) sc->offs = 0; sc->spkrctl = sbdsp_speaker_ctl; sc->spkrarg = ssc; - strcpy(sc->syn.name, "SB "); + strlcpy(sc->syn.name, "SB ", sizeof sc->syn.name); opl_attach(sc); } diff --git a/sys/dev/isa/pas.c b/sys/dev/isa/pas.c index 76e8be0ecc2..c6879b40eab 100644 --- a/sys/dev/isa/pas.c +++ b/sys/dev/isa/pas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pas.c,v 1.23 2002/06/14 21:34:59 todd Exp $ */ +/* $OpenBSD: pas.c,v 1.24 2003/04/27 11:22:53 ho Exp $ */ /* $NetBSD: pas.c,v 1.37 1998/01/12 09:43:43 thorpej Exp $ */ /* @@ -417,8 +417,10 @@ pasattach(parent, self, aux) sbdsp_attach(&sc->sc_sbdsp); - sprintf(pas_device.name, "pas,%s", pasnames[sc->model]); - sprintf(pas_device.version, "%d", sc->rev); + snprintf(pas_device.name, sizeof pas_device.name, "pas,%s", + pasnames[sc->model]); + snprintf(pas_device.version, sizeof pas_device.version, "%d", + sc->rev); audio_attach_mi(&pas_hw_if, &sc->sc_sbdsp, &sc->sc_sbdsp.sc_dev); } diff --git a/sys/dev/isa/pss.c b/sys/dev/isa/pss.c index 8c21abfe361..bc90bb8c802 100644 --- a/sys/dev/isa/pss.c +++ b/sys/dev/isa/pss.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pss.c,v 1.21 2002/03/14 01:26:56 millert Exp $ */ +/* $OpenBSD: pss.c,v 1.22 2003/04/27 11:22:53 ho Exp $ */ /* $NetBSD: pss.c,v 1.38 1998/01/12 09:43:44 thorpej Exp $ */ /* @@ -1425,9 +1425,10 @@ pss_query_devinfo(addr, dip) dip->mixer_class = PSS_INPUT_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = PSS_MIC_IN_MUTE; - strcpy(dip->label.name, AudioNmicrophone); + strlcpy(dip->label.name, AudioNmicrophone, 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); break; case PSS_LINE_IN_LVL: /* line/CD */ @@ -1435,9 +1436,10 @@ pss_query_devinfo(addr, dip) dip->mixer_class = PSS_INPUT_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = PSS_LINE_IN_MUTE; - strcpy(dip->label.name, AudioNcd); + strlcpy(dip->label.name, AudioNcd, 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); break; case PSS_DAC_LVL: /* dacout */ @@ -1445,9 +1447,10 @@ pss_query_devinfo(addr, dip) dip->mixer_class = PSS_INPUT_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = PSS_DAC_MUTE; - strcpy(dip->label.name, AudioNdac); + strlcpy(dip->label.name, AudioNdac, 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); break; case PSS_REC_LVL: /* record level */ @@ -1455,18 +1458,20 @@ pss_query_devinfo(addr, dip) dip->mixer_class = PSS_RECORD_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = PSS_RECORD_SOURCE; - strcpy(dip->label.name, AudioNrecord); + strlcpy(dip->label.name, AudioNrecord, 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); break; case PSS_MON_LVL: /* monitor level */ dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = PSS_MONITOR_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNmonitor); + strlcpy(dip->label.name, AudioNmonitor, 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); break; case PSS_MASTER_VOL: /* master volume */ @@ -1474,55 +1479,57 @@ pss_query_devinfo(addr, dip) dip->mixer_class = PSS_OUTPUT_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = PSS_OUTPUT_MODE; - strcpy(dip->label.name, AudioNmaster); + strlcpy(dip->label.name, AudioNmaster, 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); break; case PSS_MASTER_TREBLE: /* master treble */ dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = PSS_OUTPUT_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNtreble); + strlcpy(dip->label.name, AudioNtreble, sizeof dip->label.name); dip->un.v.num_channels = 1; - strcpy(dip->un.v.units.name, AudioNtreble); + strlcpy(dip->un.v.units.name, AudioNtreble, + sizeof dip->un.v.units.name); break; case PSS_MASTER_BASS: /* master bass */ dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = PSS_OUTPUT_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNbass); + strlcpy(dip->label.name, AudioNbass, sizeof dip->label.name); dip->un.v.num_channels = 1; - strcpy(dip->un.v.units.name, AudioNbass); + strlcpy(dip->un.v.units.name, AudioNbass, sizeof dip->un.v.units.name); break; case PSS_OUTPUT_CLASS: /* output class descriptor */ dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = PSS_OUTPUT_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioCoutputs); + strlcpy(dip->label.name, AudioCoutputs, sizeof dip->label.name); break; case PSS_INPUT_CLASS: /* input class descriptor */ dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = PSS_INPUT_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioCinputs); + strlcpy(dip->label.name, AudioCinputs, sizeof dip->label.name); break; case PSS_MONITOR_CLASS: /* monitor class descriptor */ dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = PSS_MONITOR_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioCmonitor); + strlcpy(dip->label.name, AudioCmonitor, sizeof dip->label.name); break; case PSS_RECORD_CLASS: /* record source class */ dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = PSS_RECORD_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioCrecord); + strlcpy(dip->label.name, AudioCrecord, sizeof dip->label.name); break; case PSS_MIC_IN_MUTE: @@ -1545,11 +1552,13 @@ pss_query_devinfo(addr, dip) dip->prev = PSS_DAC_LVL; dip->next = AUDIO_MIXER_LAST; mute: - strcpy(dip->label.name, AudioNmute); + strlcpy(dip->label.name, AudioNmute, 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; break; @@ -1558,15 +1567,19 @@ pss_query_devinfo(addr, dip) dip->type = AUDIO_MIXER_ENUM; dip->prev = PSS_MASTER_VOL; dip->next = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNmode); + strlcpy(dip->label.name, AudioNmode, sizeof dip->label.name); dip->un.e.num_mem = 4; - strcpy(dip->un.e.member[0].label.name, AudioNmono); + strlcpy(dip->un.e.member[0].label.name, AudioNmono, + sizeof dip->un.e.member[0].label.name); dip->un.e.member[0].ord = PSS_SPKR_MONO; - strcpy(dip->un.e.member[1].label.name, AudioNstereo); + strlcpy(dip->un.e.member[1].label.name, AudioNstereo, + sizeof dip->un.e.member[1].label.name); dip->un.e.member[1].ord = PSS_SPKR_STEREO; - strcpy(dip->un.e.member[2].label.name, AudioNpseudo); + strlcpy(dip->un.e.member[2].label.name, AudioNpseudo, + sizeof dip->un.e.member[2].label.name); dip->un.e.member[2].ord = PSS_SPKR_PSEUDO; - strcpy(dip->un.e.member[3].label.name, AudioNspatial); + strlcpy(dip->un.e.member[3].label.name, AudioNspatial, + sizeof dip->un.e.member[3].label.name); dip->un.e.member[3].ord = PSS_SPKR_SPATIAL; break; @@ -1575,13 +1588,16 @@ pss_query_devinfo(addr, dip) dip->type = AUDIO_MIXER_ENUM; dip->prev = PSS_REC_LVL; dip->next = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNsource); + strlcpy(dip->label.name, AudioNsource, sizeof dip->label.name); 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 = PSS_MIC_IN_LVL; - 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 = PSS_LINE_IN_LVL; - strcpy(dip->un.e.member[2].label.name, AudioNdac); + strlcpy(dip->un.e.member[2].label.name, AudioNdac, + sizeof dip->un.e.member[2].label.name); dip->un.e.member[2].ord = PSS_DAC_LVL; break; diff --git a/sys/dev/isa/sb.c b/sys/dev/isa/sb.c index cf282d137ac..2b29d34e9c5 100644 --- a/sys/dev/isa/sb.c +++ b/sys/dev/isa/sb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sb.c,v 1.22 2002/03/14 03:16:05 millert Exp $ */ +/* $OpenBSD: sb.c,v 1.23 2003/04/27 11:22:53 ho Exp $ */ /* $NetBSD: sb.c,v 1.57 1998/01/12 09:43:46 thorpej Exp $ */ /* @@ -298,17 +298,17 @@ sb_getdev(addr, retp) char *config; if (sc->sc_model == SB_JAZZ) - strncpy(retp->name, "MV Jazz16", sizeof(retp->name)); + strlcpy(retp->name, "MV Jazz16", sizeof retp->name); else - strncpy(retp->name, "SoundBlaster", sizeof(retp->name)); - sprintf(retp->version, "%d.%02d", - SBVER_MAJOR(sc->sc_version), - SBVER_MINOR(sc->sc_version)); + strlcpy(retp->name, "SoundBlaster", sizeof retp->name); + snprintf(retp->version, sizeof retp->version, "%d.%02d", + SBVER_MAJOR(sc->sc_version), + SBVER_MINOR(sc->sc_version)); if (0 <= sc->sc_model && sc->sc_model < sizeof names / sizeof names[0]) config = names[sc->sc_model]; else config = "??"; - strncpy(retp->config, config, sizeof(retp->config)); + strlcpy(retp->config, config, sizeof retp->config); return 0; } diff --git a/sys/dev/isa/sb_isa.c b/sys/dev/isa/sb_isa.c index a4ced78c864..999e9c6c7dd 100644 --- a/sys/dev/isa/sb_isa.c +++ b/sys/dev/isa/sb_isa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sb_isa.c,v 1.6 2002/03/14 01:26:56 millert Exp $ */ +/* $OpenBSD: sb_isa.c,v 1.7 2003/04/27 11:22:53 ho Exp $ */ /* $NetBSD: sb_isa.c,v 1.15 1997/11/30 15:32:25 drochner Exp $ */ /* @@ -97,7 +97,7 @@ sb_isa_match(parent, match, aux) #else sc->sc_dev.dv_cfdata = match; #endif - strcpy(sc->sc_dev.dv_xname, "sb"); + strlcpy(sc->sc_dev.dv_xname, "sb", sizeof sc->sc_dev.dv_xname); return sbfind(parent, sc, aux); } 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; diff --git a/sys/dev/isa/wss.c b/sys/dev/isa/wss.c index bc9003dace5..879a09b06b1 100644 --- a/sys/dev/isa/wss.c +++ b/sys/dev/isa/wss.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wss.c,v 1.21 2002/03/14 01:26:56 millert Exp $ */ +/* $OpenBSD: wss.c,v 1.22 2003/04/27 11:22:53 ho Exp $ */ /* $NetBSD: wss.c,v 1.42 1998/01/19 22:18:23 augustss Exp $ */ /* @@ -211,9 +211,9 @@ wss_query_devinfo(addr, dip) dip->mixer_class = WSS_INPUT_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = WSS_MIC_IN_MUTE; - strcpy(dip->label.name, AudioNmicrophone); + strlcpy(dip->label.name, AudioNmicrophone, 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); break; case WSS_LINE_IN_LVL: /* line/CD */ @@ -221,9 +221,9 @@ wss_query_devinfo(addr, dip) dip->mixer_class = WSS_INPUT_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = WSS_LINE_IN_MUTE; - strcpy(dip->label.name, AudioNcd); + strlcpy(dip->label.name, AudioNcd, 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); break; case WSS_DAC_LVL: /* dacout */ @@ -231,9 +231,9 @@ wss_query_devinfo(addr, dip) dip->mixer_class = WSS_INPUT_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = WSS_DAC_MUTE; - strcpy(dip->label.name, AudioNdac); + strlcpy(dip->label.name, AudioNdac, 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); break; case WSS_REC_LVL: /* record level */ @@ -241,39 +241,39 @@ wss_query_devinfo(addr, dip) dip->mixer_class = WSS_RECORD_CLASS; dip->prev = AUDIO_MIXER_LAST; dip->next = WSS_RECORD_SOURCE; - strcpy(dip->label.name, AudioNrecord); + strlcpy(dip->label.name, AudioNrecord, 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); break; case WSS_MON_LVL: /* monitor level */ dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = WSS_MONITOR_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNmonitor); + strlcpy(dip->label.name, AudioNmonitor, 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); break; case WSS_INPUT_CLASS: /* input class descriptor */ dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = WSS_INPUT_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioCinputs); + strlcpy(dip->label.name, AudioCinputs, sizeof dip->label.name); break; case WSS_MONITOR_CLASS: /* monitor class descriptor */ dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = WSS_MONITOR_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioCmonitor); + strlcpy(dip->label.name, AudioCmonitor, sizeof dip->label.name); break; case WSS_RECORD_CLASS: /* record source class */ dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = WSS_RECORD_CLASS; dip->next = dip->prev = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioCrecord); + strlcpy(dip->label.name, AudioCrecord, sizeof dip->label.name); break; case WSS_MIC_IN_MUTE: @@ -296,11 +296,13 @@ wss_query_devinfo(addr, dip) dip->prev = WSS_DAC_LVL; dip->next = AUDIO_MIXER_LAST; mute: - strcpy(dip->label.name, AudioNmute); + strlcpy(dip->label.name, AudioNmute, 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; break; @@ -309,13 +311,16 @@ wss_query_devinfo(addr, dip) dip->type = AUDIO_MIXER_ENUM; dip->prev = WSS_REC_LVL; dip->next = AUDIO_MIXER_LAST; - strcpy(dip->label.name, AudioNsource); + strlcpy(dip->label.name, AudioNsource, sizeof dip->label.name); 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 = WSS_MIC_IN_LVL; - 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 = WSS_LINE_IN_LVL; - strcpy(dip->un.e.member[2].label.name, AudioNdac); + strlcpy(dip->un.e.member[2].label.name, AudioNdac, + sizeof dip->un.e.member[2].label.name); dip->un.e.member[2].ord = WSS_DAC_LVL; break; diff --git a/sys/dev/isa/ym.c b/sys/dev/isa/ym.c index 5a25fc7136b..d96cc31f40c 100644 --- a/sys/dev/isa/ym.c +++ b/sys/dev/isa/ym.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ym.c,v 1.11 2002/03/14 03:16:05 millert Exp $ */ +/* $OpenBSD: ym.c,v 1.12 2003/04/27 11:22:53 ho Exp $ */ /* @@ -453,8 +453,9 @@ ym_query_devinfo(addr, dip) case YM_EQ_CLASS: dip->type = AUDIO_MIXER_CLASS; dip->mixer_class = dip->index; - strcpy(dip->label.name, - mixer_classes[dip->index - YM_INPUT_CLASS]); + strlcpy(dip->label.name, + mixer_classes[dip->index - YM_INPUT_CLASS], + sizeof dip->label.name); break; case YM_MIDI_LVL: @@ -472,7 +473,9 @@ ym_query_devinfo(addr, dip) dip->next = dip->index + 7; - strcpy(dip->label.name, mixer_port_names[dip->index - YM_MIDI_LVL]); + strlcpy(dip->label.name, + mixer_port_names[dip->index - YM_MIDI_LVL], + sizeof dip->label.name); if (dip->index == YM_SPEAKER_LVL || dip->index == YM_MIC_LVL) @@ -480,7 +483,8 @@ ym_query_devinfo(addr, dip) else 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); break; case YM_MIDI_MUTE: @@ -497,11 +501,13 @@ ym_query_devinfo(addr, dip) dip->type = AUDIO_MIXER_ENUM; dip->prev = dip->index - 7; mute: - strcpy(dip->label.name, AudioNmute); + strlcpy(dip->label.name, AudioNmute, 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; break; @@ -510,9 +516,10 @@ mute: dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = YM_OUTPUT_CLASS; dip->next = YM_OUTPUT_MUTE; - strcpy(dip->label.name, AudioNmaster); + strlcpy(dip->label.name, AudioNmaster, 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); break; case YM_OUTPUT_MUTE: @@ -525,9 +532,10 @@ mute: dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = YM_RECORD_CLASS; dip->next = YM_RECORD_SOURCE; - strcpy(dip->label.name, AudioNrecord); + strlcpy(dip->label.name, AudioNrecord, 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); break; @@ -535,56 +543,69 @@ mute: dip->mixer_class = YM_RECORD_CLASS; dip->type = AUDIO_MIXER_ENUM; dip->prev = YM_REC_LVL; - strcpy(dip->label.name, AudioNsource); + strlcpy(dip->label.name, AudioNsource, sizeof dip->label.name); dip->un.e.num_mem = 4; - 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 = MIC_IN_PORT; - strcpy(dip->un.e.member[1].label.name, AudioNline); + strlcpy(dip->un.e.member[1].label.name, AudioNline, + sizeof dip->un.e.member[1].label.name); dip->un.e.member[1].ord = LINE_IN_PORT; - strcpy(dip->un.e.member[2].label.name, AudioNdac); + strlcpy(dip->un.e.member[2].label.name, AudioNdac, + sizeof dip->un.e.member[2].label.name); dip->un.e.member[2].ord = DAC_IN_PORT; - strcpy(dip->un.e.member[3].label.name, AudioNcd); + strlcpy(dip->un.e.member[3].label.name, AudioNcd, + sizeof dip->un.e.member[3].label.name); dip->un.e.member[3].ord = AUX1_IN_PORT; break; case YM_MASTER_EQMODE: dip->type = AUDIO_MIXER_ENUM; dip->mixer_class = YM_EQ_CLASS; - strcpy(dip->label.name, AudioNmode); - strcpy(dip->un.v.units.name, AudioNmode); + strlcpy(dip->label.name, AudioNmode, sizeof dip->label.name); + strlcpy(dip->un.v.units.name, AudioNmode, + sizeof dip->un.v.units.name); dip->un.e.num_mem = 4; - strcpy(dip->un.e.member[0].label.name, AudioNdesktop); + strlcpy(dip->un.e.member[0].label.name, AudioNdesktop, + sizeof dip->un.e.member[0].label.name); dip->un.e.member[0].ord = SA3_SYS_CTL_YMODE0; - strcpy(dip->un.e.member[1].label.name, AudioNlaptop); + strlcpy(dip->un.e.member[1].label.name, AudioNlaptop, + sizeof dip->un.e.member[1].label.name); dip->un.e.member[1].ord = SA3_SYS_CTL_YMODE1; - strcpy(dip->un.e.member[2].label.name, AudioNsubnote); + strlcpy(dip->un.e.member[2].label.name, AudioNsubnote, + sizeof dip->un.e.member[2].label.name); dip->un.e.member[2].ord = SA3_SYS_CTL_YMODE2; - strcpy(dip->un.e.member[3].label.name, AudioNhifi); + strlcpy(dip->un.e.member[3].label.name, AudioNhifi, + sizeof dip->un.e.member[3].label.name); dip->un.e.member[3].ord = SA3_SYS_CTL_YMODE3; break; case YM_MASTER_TREBLE: dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = YM_EQ_CLASS; - strcpy(dip->label.name, AudioNtreble); + strlcpy(dip->label.name, AudioNtreble, sizeof dip->label.name); 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); break; case YM_MASTER_BASS: dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = YM_EQ_CLASS; - strcpy(dip->label.name, AudioNbass); + strlcpy(dip->label.name, AudioNbass, sizeof dip->label.name); 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); break; case YM_MASTER_WIDE: dip->type = AUDIO_MIXER_VALUE; dip->mixer_class = YM_EQ_CLASS; - strcpy(dip->label.name, AudioNsurround); + strlcpy(dip->label.name, AudioNsurround, + sizeof dip->label.name); dip->un.v.num_channels = 2; - strcpy(dip->un.v.units.name, AudioNsurround); + strlcpy(dip->un.v.units.name, AudioNsurround, + sizeof dip->un.v.units.name); break; default: |