Skip to content

Commit

Permalink
config BUGFIX fix sprintf and va undef behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
roman committed Jun 8, 2023
1 parent 4cc9498 commit 94ac92e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/config_new_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,13 +487,13 @@ nc_server_config_new_tls_version(const struct ly_ctx *ctx, const char *endpt_nam

API int
nc_server_config_new_tls_ciphers(const struct ly_ctx *ctx, const char *endpt_name, struct lyd_node **config,
uint16_t cipher_count, ...)
int cipher_count, ...)
{
int ret = 0;
struct lyd_node *new_tree = NULL, *old = NULL;
va_list ap;
char *tree_path = NULL, *cipher = NULL, *cipher_ident = NULL;
uint16_t i;
int i;

NC_CHECK_ARG_RET(NULL, ctx, endpt_name, config, 1);

Expand Down
6 changes: 4 additions & 2 deletions src/server_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -2153,7 +2153,8 @@ nc_server_config_transport_params(const char *algorithm, char **alg_store, NC_OP
ret = 1;
goto cleanup;
}
sprintf(*alg_store, "%s,%s", *alg_store, alg);
strcat(*alg_store, ",");
strcat(*alg_store, alg);
}
} else {
/* delete */
Expand Down Expand Up @@ -3094,7 +3095,8 @@ nc_server_config_create_cipher_suite(struct nc_server_tls_opts *opts, const char
ret = 1;
goto cleanup;
}
sprintf(opts->ciphers, "%s:%s", opts->ciphers, ssl_cipher);
strcat(opts->ciphers, ":");
strcat(opts->ciphers, ssl_cipher);
}

cleanup:
Expand Down
2 changes: 1 addition & 1 deletion src/server_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ int nc_server_config_new_tls_version(const struct ly_ctx *ctx, const char *endpt
* @return 0 on success, non-zero otherwise.
*/
int nc_server_config_new_tls_ciphers(const struct ly_ctx *ctx, const char *endpt_name, struct lyd_node **config,
uint16_t cipher_count, ...);
int cipher_count, ...);

#endif /* NC_ENABLED_SSH_TLS */

Expand Down

0 comments on commit 94ac92e

Please sign in to comment.