diff options
author | Ulf Brosziewski <bru@cvs.openbsd.org> | 2020-04-26 11:31:08 +0000 |
---|---|---|
committer | Ulf Brosziewski <bru@cvs.openbsd.org> | 2020-04-26 11:31:08 +0000 |
commit | b39828359c98990a9dc77db222b7b47bc86cf338 (patch) | |
tree | 77ed211ace219272a32225d21b8ebb1c235681b5 /sys/dev | |
parent | ba05ad3de82e4ac2913780dfc16d6d76bee1b13c (diff) |
Make explicit and enforce that WSCREEN and WSEMUL names are 0-terminated.
CID 1452993 (BUFFER_SIZE_WARNING)
CID 1453314 (BUFFER_SIZE_WARNING)
ok kettenis@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/wscons/wsdisplay.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c index e0f16514133..75edf7ba303 100644 --- a/sys/dev/wscons/wsdisplay.c +++ b/sys/dev/wscons/wsdisplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsdisplay.c,v 1.137 2020/04/19 15:05:14 kettenis Exp $ */ +/* $OpenBSD: wsdisplay.c,v 1.138 2020/04/26 11:31:07 bru Exp $ */ /* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */ /* @@ -426,9 +426,9 @@ wsdisplay_getscreen(struct wsdisplay_softc *sc, if (scr == NULL) return (ENXIO); - strncpy(sd->screentype, scr->scr_dconf->scrdata->name, + strlcpy(sd->screentype, scr->scr_dconf->scrdata->name, WSSCREEN_NAME_SIZE); - strncpy(sd->emul, scr->scr_dconf->wsemul->name, WSEMUL_NAME_SIZE); + strlcpy(sd->emul, scr->scr_dconf->wsemul->name, WSEMUL_NAME_SIZE); return (0); } @@ -1265,7 +1265,7 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, struct wsscreen *scr, return(EINVAL); d->nidx = sc->sc_scrdata->nscreens; - strncpy(d->name, sc->sc_scrdata->screens[d->idx]->name, + strlcpy(d->name, sc->sc_scrdata->screens[d->idx]->name, WSSCREEN_NAME_SIZE); d->ncols = sc->sc_scrdata->screens[d->idx]->ncols; d->nrows = sc->sc_scrdata->screens[d->idx]->nrows; @@ -1277,7 +1277,7 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, struct wsscreen *scr, #define d ((struct wsdisplay_emultype *)data) if (wsemul_getname(d->idx) == NULL) return(EINVAL); - strncpy(d->name, wsemul_getname(d->idx), WSEMUL_NAME_SIZE); + strlcpy(d->name, wsemul_getname(d->idx), WSEMUL_NAME_SIZE); return (0); #undef d } |