Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm Say n...



details:   https://anonhg.NetBSD.org/src/rev/45d86c75b8db
branches:  trunk
changeset: 992748:45d86c75b8db
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 07:41:00 2018 +0000

description:
Say no to sprintf!

diffstat:

 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm/nouveau_nvkm_subdev_mxm_mxms.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 634fdd304874 -r 45d86c75b8db sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm/nouveau_nvkm_subdev_mxm_mxms.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm/nouveau_nvkm_subdev_mxm_mxms.c     Mon Aug 27 07:40:50 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm/nouveau_nvkm_subdev_mxm_mxms.c     Mon Aug 27 07:41:00 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_nvkm_subdev_mxm_mxms.c,v 1.2 2018/08/27 04:58:34 riastradh Exp $       */
+/*     $NetBSD: nouveau_nvkm_subdev_mxm_mxms.c,v 1.3 2018/08/27 07:41:00 riastradh Exp $       */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -24,7 +24,7 @@
  * Authors: Ben Skeggs
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_mxm_mxms.c,v 1.2 2018/08/27 04:58:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_mxm_mxms.c,v 1.3 2018/08/27 07:41:00 riastradh Exp $");
 
 #include "mxms.h"
 
@@ -160,13 +160,15 @@
                        int i, j;
 
                        for (j = headerlen - 1, ptr = data; j >= 0; j--)
-                               ptr += sprintf(ptr, "%02x", dump[j]);
+                               ptr += snprintf(ptr, sizeof data - (ptr - data),
+                                   "%02x", dump[j]);
                        dump += headerlen;
 
                        nvkm_debug(subdev, "%4s: %s\n", mxms_desc[type], data);
                        for (i = 0; i < entries; i++, dump += recordlen) {
                                for (j = recordlen - 1, ptr = data; j >= 0; j--)
-                                       ptr += sprintf(ptr, "%02x", dump[j]);
+                                       ptr += snprintf(ptr, sizeof data -
+                                           (ptr - data), "%02x", dump[j]);
                                nvkm_debug(subdev, "      %s\n", data);
                        }
                }



Home | Main Index | Thread Index | Old Index