@@ -3262,7 +3262,7 @@ char *yytext;
32623262/*
32633263 * SPDX-License-Identifier: ISC
32643264 *
3265- * Copyright (c) 1996, 1998-2005, 2007-2024
3265+ * Copyright (c) 1996, 1998-2005, 2007-2025
32663266 * Todd C. Miller <[email protected] > 32673267 *
32683268 * Permission to use, copy, modify, and distribute this software for any
@@ -5982,14 +5982,15 @@ expand_include(const char *src, const char *host)
59825982 * If the current sudoers file was opened via a colon-separated path,
59835983 * use the same path when opening src.
59845984 */
5985- dst_size = 0 ;
5985+ dst_size = 1 ;
59865986 for (cp = sudo_strsplit (path , path_end , ":" , & ep ); cp != NULL ;
59875987 cp = sudo_strsplit (NULL , path_end , ":" , & ep )) {
59885988 char * dirend = memrchr (cp , '/' , (size_t )(ep - cp ));
59895989 if (dirend != NULL ) {
5990+ /* Include space for trailing '/' separator. */
59905991 dst_size += (size_t )(dirend - cp ) + 1 ;
59915992 }
5992- /* Includes space for ':' separator and NUL terminator . */
5993+ /* Includes space for expanded host and ':' separator . */
59935994 dst_size += src_len + (nhost * strlen (host )) - (nhost * 2 ) + 1 ;
59945995 }
59955996
0 commit comments