Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Sep 2019 14:06:47 -0000
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r346159 - head/usr.sbin/bhyve
Message-ID:  <201904121813.x3CIDwow006814@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Fri Apr 12 18:13:57 2019
New Revision: 346159
URL: https://svnweb.freebsd.org/changeset/base/346159

Log:
  Fix thread name buffer overflow.
  
  MFC after:	1 week

Modified:
  head/usr.sbin/bhyve/pci_virtio_scsi.c

Modified: head/usr.sbin/bhyve/pci_virtio_scsi.c
==============================================================================
--- head/usr.sbin/bhyve/pci_virtio_scsi.c	Fri Apr 12 17:27:19 2019	(r346158)
+++ head/usr.sbin/bhyve/pci_virtio_scsi.c	Fri Apr 12 18:13:57 2019	(r346159)
@@ -634,7 +634,7 @@ pci_vtscsi_init_queue(struct pci_vtscsi_softc *sc, 
     struct pci_vtscsi_queue *queue, int num)
 {
 	struct pci_vtscsi_worker *worker;
-	char threadname[16];
+	char tname[MAXCOMLEN + 1];
 	int i;
 
 	queue->vsq_sc = sc;
@@ -653,8 +653,8 @@ pci_vtscsi_init_queue(struct pci_vtscsi_softc *sc, 
 		pthread_create(&worker->vsw_thread, NULL, &pci_vtscsi_proc,
 		    (void *)worker);
 
-		sprintf(threadname, "virtio-scsi:%d-%d", num, i);
-		pthread_set_name_np(worker->vsw_thread, threadname);
+		snprintf(tname, sizeof(tname), "vtscsi:%d-%d", num, i);
+		pthread_set_name_np(worker->vsw_thread, tname);
 		LIST_INSERT_HEAD(&queue->vsq_workers, worker, vsw_link);
 	}
 





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904121813.x3CIDwow006814>