diff options
| author | Tony Finch <dot@dotat.at> | 2012-02-21 13:27:28 +0000 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2019-07-18 23:04:57 +0200 |
| commit | 774e33ad445c3f70ec5bbcabf0aee39355d816ef (patch) | |
| tree | 17fcab99d1a0e5e879f383fd2fa153679ae91c06 | |
| parent | 8c74456bfa3a19fb4e8f4e2a801a95ea14a6efb6 (diff) | |
unifdef.c: use memcpy() instead of the dodgy strncpy().
This makes it clearer that I do not want a '\0' terminator.
Submitted by: Carsten Hey <carsten@debian.org>
Change-Id: I7b14346e2c32604afdbfd0e6b08baabe8a0ec54b
| -rw-r--r-- | scripts/unifdef.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/unifdef.c b/scripts/unifdef.c index 7493c0ee5..db00e3e30 100644 --- a/scripts/unifdef.c +++ b/scripts/unifdef.c @@ -395,7 +395,7 @@ usage(void) * When we have processed a group that starts off with a known-false * #if/#elif sequence (which has therefore been deleted) followed by a * #elif that we don't understand and therefore must keep, we edit the - * latter into a #if to keep the nesting correct. We use strncpy() to + * latter into a #if to keep the nesting correct. We use memcpy() to * overwrite the 4 byte token "elif" with "if " without a '\0' byte. * * When we find a true #elif in a group, the following block will @@ -450,7 +450,7 @@ static void Idrop (void) { Fdrop(); ignoreon(); } static void Itrue (void) { Ftrue(); ignoreon(); } static void Ifalse(void) { Ffalse(); ignoreon(); } /* modify this line */ -static void Mpass (void) { strncpy(keyword, "if ", 4); Pelif(); } +static void Mpass (void) { memcpy(keyword, "if ", 4); Pelif(); } static void Mtrue (void) { keywordedit("else"); state(IS_TRUE_MIDDLE); } static void Melif (void) { keywordedit("endif"); state(IS_FALSE_TRAILER); } static void Melse (void) { keywordedit("endif"); state(IS_FALSE_ELSE); } |
