Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libbluetooth Use strlcpy to NUL terminate the name strin...
details: https://anonhg.NetBSD.org/src/rev/6b6448e1bed0
branches: trunk
changeset: 464346:6b6448e1bed0
user: christos <christos%NetBSD.org@localhost>
date: Thu Oct 03 17:10:16 2019 +0000
description:
Use strlcpy to NUL terminate the name string here. The kernel already
uses strlcpy() to set values in this field. We leave the kernel's strncmp()
alone to maintain compatibility.
diffstat:
lib/libbluetooth/bt_dev.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (36 lines):
diff -r b49b311cadd5 -r 6b6448e1bed0 lib/libbluetooth/bt_dev.c
--- a/lib/libbluetooth/bt_dev.c Thu Oct 03 17:08:26 2019 +0000
+++ b/lib/libbluetooth/bt_dev.c Thu Oct 03 17:10:16 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bt_dev.c,v 1.3 2010/11/22 19:59:04 plunky Exp $ */
+/* $NetBSD: bt_dev.c,v 1.4 2019/10/03 17:10:16 christos Exp $ */
/*-
* Copyright (c) 2009 Iain Hibbert
@@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: bt_dev.c,v 1.3 2010/11/22 19:59:04 plunky Exp $");
+__RCSID("$NetBSD: bt_dev.c,v 1.4 2019/10/03 17:10:16 christos Exp $");
#include <sys/event.h>
#include <sys/ioctl.h>
@@ -92,7 +92,7 @@
return bt_devname(NULL, addr);
memset(&btr, 0, sizeof(btr));
- strncpy(btr.btr_name, name, HCI_DEVNAME_SIZE);
+ strlcpy(btr.btr_name, name, HCI_DEVNAME_SIZE);
s = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
if (s == -1)
@@ -781,7 +781,7 @@
struct btreq btr;
memset(&btr, 0, sizeof(btr));
- strncpy(btr.btr_name, name, HCI_DEVNAME_SIZE);
+ strlcpy(btr.btr_name, name, HCI_DEVNAME_SIZE);
if (ioctl(s, SIOCGBTINFO, &btr) == -1)
return -1;
Home |
Main Index |
Thread Index |
Old Index