Skip to content

Commit 1868757

Browse files
Michal StruweSESA747457
authored andcommitted
server_config_util_ssh: make hash buffer static to avoid large call stack
1 parent c22284b commit 1868757

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/server_config_util_ssh.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,12 @@ _nc_server_config_add_ssh_user_password(const struct ly_ctx *ctx, const char *tr
498498
int ret = 0;
499499
char *hashed_pw = NULL;
500500
const char *salt = "$6$idsizuippipk$";
501-
struct crypt_data cdata = {0};
501+
static struct crypt_data cdata;
502502

503503
NC_CHECK_ARG_RET(NULL, ctx, tree_path, password, config, 1);
504504

505+
memset(&cdata, 0, sizeof(struct crypt_data));
506+
505507
hashed_pw = crypt_r(password, salt, &cdata);
506508
if (!hashed_pw) {
507509
ERR(NULL, "Hashing password failed (%s).", strerror(errno));

0 commit comments

Comments
 (0)