Skip to content

Commit 14a036d

Browse files
Sam RavnborgSam Ravnborg
authored andcommitted
kbuild: replace use of strlcpy with a dedicated implmentation in unifdef
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
1 parent 01f1c87 commit 14a036d

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

scripts/unifdef.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,14 @@ ignoreon(void)
450450
static void
451451
keywordedit(const char *replacement)
452452
{
453-
strlcpy(keyword, replacement, tline + sizeof(tline) - keyword);
453+
size_t size = tline + sizeof(tline) - keyword;
454+
char *dst = keyword;
455+
const char *src = replacement;
456+
if (size != 0) {
457+
while ((--size != 0) && (*src != '\0'))
458+
*dst++ = *src++;
459+
*dst = '\0';
460+
}
454461
print();
455462
}
456463
static void

0 commit comments

Comments
 (0)