Skip to content

Commit

Permalink
kex: use snprintf() for rpc memory mod stats
Browse files Browse the repository at this point in the history
- safer to ensure it doesn't overflow the target buffer
  • Loading branch information
miconda committed Apr 16, 2019
1 parent 7e87138 commit 99896b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/modules/kex/mod_stats.c
Expand Up @@ -105,7 +105,7 @@ static int rpc_mod_print(rpc_t *rpc, void *ctx, const char *mname,

while (iter) {
if (strcmp(mname, iter->mname) == 0) {
sprintf(buff, "%s(%ld)", iter->func, iter->line);
snprintf(buff, 128, "%s(%ld)", iter->func, iter->line);
if (rpc->struct_add(stats_th, "d", buff, iter->size) < 0) {
rpc->fault(ctx, 500, "Internal error adding to struct rpc");
return -1;
Expand Down

0 comments on commit 99896b1

Please sign in to comment.