ban->lines = realloc (ban->lines, sizeof (char *) * ban->len);
if (len >= DGL_BANNER_LINELEN) {
len = DGL_BANNER_LINELEN;
- ban->lines[ban->len - 1] = malloc(len);
+ ban->lines[ban->len - 1] = malloc(len+1);
strncpy(ban->lines[ban->len - 1], line, len);
- ban->lines[ban->len - 1][len-1] = '\0';
+ ban->lines[ban->len - 1][len+1] = '\0';
} else
ban->lines[ban->len - 1] = strdup(line);
}
if ((slen > 0) && (buf[slen-1] == '\n'))
buf[slen-1] = '\0';
- strncpy(bufnew, buf, DGL_BANNER_LINELEN);
- if ( inclpos = strstr(bufnew, "$INCLUDE(") ) {
+ strncpy(bufnew, buf, DGL_BANNER_LINELEN+1);
+ if ( (inclpos = strstr(bufnew, "$INCLUDE(")) ) {
char *fn = inclpos + 9;
char *fn_end = strchr(fn, ')');
if (fn_end) {
games[i]->is_in_shm = 1;
games[i]->shm_idx = di;
shm_dg_data->cur_n_games++;
- strncpy(shm_dg_game[di].ttyrec_fn, games[i]->ttyrec_fn, 150);
+ strncpy(shm_dg_game[di].ttyrec_fn, games[i]->ttyrec_fn, 149);
break;
}
}
mins = (secs / 60) % 60;
secs -= (mins*60);
if (hours)
- snprintf(data, 10, "%ldh %ldm", hours, mins);
+ snprintf(data, 24, "%ldh %ldm", hours, mins);
else if (mins)
snprintf(data, 10, "%ldm %lds", mins, secs);
else if (secs > 4)
}
drawbanner(&ban);
if (menu->cursor_x >= 0 && menu->cursor_y >= 0)
- mvprintw(menu->cursor_y, menu->cursor_x, "");
+ mvaddstr(menu->cursor_y, menu->cursor_x, "");
refresh();
userchoice = dgl_getch();
if (userchoice == ERR) {
DIR *pdir;
struct dirent *pdirent;
struct stat pstat;
- char fullname[130], ttyrecname[130], pidws[80], playername[DGL_PLAYERNAMELEN+1];
+ char fullname[512], ttyrecname[130], pidws[80], playername[DGL_PLAYERNAMELEN+1];
char *replacestr, *dir, *p;
struct dg_game **games = NULL;
struct flock fl = { 0 };
if (!inprog) continue;
- snprintf (fullname, 130, "%s%s", inprog, pdirent->d_name);
+ snprintf (fullname, 512, "%s%s", inprog, pdirent->d_name);
free(inprog);
fd = 0;