kern/52960: kbdcontrol macros don't work when len%
Dmitry Sivachenko
mitya at demos.su
Thu Jun 5 03:30:10 PDT 2003
The following reply was made to PR kern/52960; it has been noted by GNATS.
From: Dmitry Sivachenko <mitya at demos.su>
To: freebsd-gnats-submit at FreeBSD.org
Cc: mat at hak.cnd.mcgill.ca
Subject: Re: kern/52960: kbdcontrol macros don't work when len%
Date: Thu, 5 Jun 2003 14:24:50 +0400
The following patch fixes the problem. When you supply exactly
MAXFK(=16) chararacters as a macro, you should use strncpy which does not
append trailing '\0'.
--- kbdcontrol.c.orig Thu Jun 5 14:19:13 2003
+++ kbdcontrol.c Thu Jun 5 14:17:52 2003
@@ -848,7 +848,7 @@
fkey.flen, MAXFK);
return;
}
- strcpy(fkey.keydef, string);
+ strncpy(fkey.keydef, string, MAXFK);
fkey.keynum -= 1;
if (ioctl(0, SETFKEY, &fkey) < 0)
warn("setting function key");
More information about the freebsd-bugs
mailing list