From ed8873b14671073b4bd24d788dc61bcbf4fdfb14 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 18:15:00 +0200 Subject: Merging upstream version 3.3.0. Signed-off-by: Daniel Baumann --- exclude.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'exclude.c') diff --git a/exclude.c b/exclude.c index ffe55b1..87edbcf 100644 --- a/exclude.c +++ b/exclude.c @@ -4,7 +4,7 @@ * Copyright (C) 1996-2001 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras * Copyright (C) 2002 Martin Pool - * Copyright (C) 2003-2022 Wayne Davison + * Copyright (C) 2003-2024 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -720,7 +720,8 @@ static BOOL setup_merge_file(int mergelist_num, filter_rule *ex, parent_dirscan = True; while (*y) { char save[MAXPATHLEN]; - strlcpy(save, y, MAXPATHLEN); + /* copylen is strlen(y) which is < MAXPATHLEN. +1 for \0 */ + size_t copylen = strlcpy(save, y, MAXPATHLEN) + 1; *y = '\0'; dirbuf_len = y - dirbuf; strlcpy(x, ex->pattern, MAXPATHLEN - (x - buf)); @@ -734,7 +735,7 @@ static BOOL setup_merge_file(int mergelist_num, filter_rule *ex, lp->head = NULL; } lp->tail = NULL; - strlcpy(y, save, MAXPATHLEN); + strlcpy(y, save, copylen); while ((*x++ = *y++) != '/') {} } parent_dirscan = False; -- cgit v1.2.3