Skip to content

Commit

Permalink
ft_ubertest: Fix seg fault
Browse files Browse the repository at this point in the history
Fix crash in uber test:

#0  0x00000000004036fb in fts_cur_info (series=<value optimized out>,
    info=0x60c920) at complex/ft_config.c:613
#1  0x0000000000402568 in ft_fw_client (argc=<value optimized out>,
    argv=<value optimized out>) at complex/ft_main.c:412
#2  main (argc=<value optimized out>, argv=<value optimized out>)
    at complex/ft_main.c:511

The opts strings may be overrun.

Set the default destination port, so that the test can run.

Signed-off-by: Sean Hefty <[email protected]>
  • Loading branch information
shefty committed Oct 12, 2015
1 parent aff4f34 commit 821829d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions complex/ft_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,13 @@ void fts_cur_info(struct ft_series *series, struct ft_info *info)
info->eq_wait_obj = set->eq_wait_obj[series->cur_eq_wait_obj];
info->cq_wait_obj = set->cq_wait_obj[series->cur_cq_wait_obj];

memcpy(info->node, set->node[0] ? set->node : opts.dst_addr, FI_NAME_MAX);
memcpy(info->service, set->service[0] ? set->service : opts.dst_port, FI_NAME_MAX);
memcpy(info->prov_name, set->prov_name, FI_NAME_MAX);
if (set->node[0])
strncpy(info->node, set->node, sizeof info->node);
else if (opts.dst_addr)
strncpy(info->node, opts.dst_addr, sizeof info->node);
if (set->service[0])
strncpy(info->service, set->service, sizeof info->node);
else if (opts.dst_port)
strncpy(info->service, opts.dst_port, sizeof info->node);
strncpy(info->prov_name, set->prov_name, FI_NAME_MAX);
}
1 change: 1 addition & 0 deletions complex/ft_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ int main(int argc, char **argv)
opts.dst_addr = (optind == argc - 1) ? argv[optind] : NULL;

if (opts.dst_addr) {
opts.dst_port = default_port;
series = fts_load(filename);
if (!series)
exit(1);
Expand Down

0 comments on commit 821829d

Please sign in to comment.