cf: remove truncate compiler warnings while formatting column titles #226

This commit is contained in:
Kaian 2017-12-20 13:57:02 +01:00
parent c89fe85195
commit 19c5cba2f2
1 changed files with 5 additions and 3 deletions

View File

@ -309,11 +309,13 @@ call_flow_draw_columns(ui_t *ui)
} }
if (setting_enabled(SETTING_CF_SPLITCALLID) || !column->addr.port) { if (setting_enabled(SETTING_CF_SPLITCALLID) || !column->addr.port) {
sprintf(coltext, "%s", column->alias); snprintf(coltext, MAX_SETTING_LEN, "%s", column->alias);
} else if (setting_enabled(SETTING_DISPLAY_ALIAS)) { } else if (setting_enabled(SETTING_DISPLAY_ALIAS)) {
sprintf(coltext, "%s:%u", column->alias, column->addr.port); snprintf(coltext, MAX_SETTING_LEN, "%.*s:%u",
MAX_SETTING_LEN - 7, column->alias, column->addr.port);
} else { } else {
sprintf(coltext, "%s:%u", column->addr.ip, column->addr.port); snprintf(coltext, MAX_SETTING_LEN, "%.*s:%u",
MAX_SETTING_LEN - 7, column->addr.ip, column->addr.port);
} }
mvwprintw(ui->win, 2, 10 + 30 * column->colpos + (22 - strlen(coltext)) / 2, "%s", coltext); mvwprintw(ui->win, 2, 10 + 30 * column->colpos + (22 - strlen(coltext)) / 2, "%s", coltext);