Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/btpin avoid strcpy.
details: https://anonhg.NetBSD.org/src/rev/deee32225d40
branches: trunk
changeset: 845694:deee32225d40
user: christos <christos%NetBSD.org@localhost>
date: Sat Oct 12 17:50:56 2019 +0000
description:
avoid strcpy.
diffstat:
usr.bin/btpin/btpin.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (31 lines):
diff -r b719f1f2b44e -r deee32225d40 usr.bin/btpin/btpin.c
--- a/usr.bin/btpin/btpin.c Sat Oct 12 17:26:26 2019 +0000
+++ b/usr.bin/btpin/btpin.c Sat Oct 12 17:50:56 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: btpin.c,v 1.7 2017/12/21 09:04:34 plunky Exp $ */
+/* $NetBSD: btpin.c,v 1.8 2019/10/12 17:50:56 christos Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2006 Itronix, Inc. All rights reserved.");
-__RCSID("$NetBSD: btpin.c,v 1.7 2017/12/21 09:04:34 plunky Exp $");
+__RCSID("$NetBSD: btpin.c,v 1.8 2019/10/12 17:50:56 christos Exp $");
#include <sys/types.h>
#include <sys/un.h>
@@ -132,8 +132,11 @@
} else {
if (len != -1)
usage();
+ len = strlen(pin);
+ if (len > HCI_PIN_SIZE)
+ len = HCI_PIN_SIZE;
- strncpy((char *)rp.pin, pin, HCI_PIN_SIZE);
+ memcpy(rp.pin, pin, len);
}
s = socket(PF_LOCAL, SOCK_STREAM, 0);
Home |
Main Index |
Thread Index |
Old Index