From 34baecf49a2926c0625e1b8272fcf270e1e2b60b Mon Sep 17 00:00:00 2001 From: Norbert Pocs Date: Sun, 23 Oct 2022 19:37:19 +0200 Subject: [PATCH] misc.c/h: Change function parameter name "template" is a c++ keyword which will make the build fail. Signed-off-by: Norbert Pocs Reviewed-by: Jakub Jelen --- include/libssh/misc.h | 2 +- src/misc.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/libssh/misc.h b/include/libssh/misc.h index ee9e73c9..6e5b581f 100644 --- a/include/libssh/misc.h +++ b/include/libssh/misc.h @@ -100,7 +100,7 @@ int ssh_mkdirs(const char *pathname, mode_t mode); int ssh_quote_file_name(const char *file_name, char *buf, size_t buf_len); int ssh_newline_vis(const char *string, char *buf, size_t buf_len); -int ssh_tmpname(char *template); +int ssh_tmpname(char *name); char *ssh_strreplace(const char *src, const char *pattern, const char *repl); #ifdef __cplusplus diff --git a/src/misc.c b/src/misc.c index e02e6da4..102be560 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1836,23 +1836,23 @@ int ssh_newline_vis(const char *string, char *buf, size_t buf_len) * * @brief Replaces the last 6 characters of a string from 'X' to 6 random hexdigits. * - * @param[in,out] template Any input string with last 6 characters as 'X'. + * @param[in,out] name Any input string with last 6 characters as 'X'. * @returns -1 as error when the last 6 characters of the input to be replaced are not 'X' * 0 otherwise. */ -int ssh_tmpname(char *template) +int ssh_tmpname(char *name) { char *tmp = NULL; size_t i = 0; int rc = 0; uint8_t random[6]; - if (template == NULL) { + if (name == NULL) { goto err; } - tmp = template + strlen(template) - 6; - if (tmp < template) { + tmp = name + strlen(name) - 6; + if (tmp < name) { goto err; }