Skip to content
Snippets Groups Projects
Commit d7096512 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Update to new Coverity Scan, fix new High impact issues

New Medium impact and a low impact issue still needs to be triaged.
parent e1f93e5c
No related branches found
No related tags found
No related merge requests found
...@@ -5346,10 +5346,10 @@ CIOLIBEXPORT char* cterm_write(struct cterminal * cterm, const void *vbuf, int b ...@@ -5346,10 +5346,10 @@ CIOLIBEXPORT char* cterm_write(struct cterminal * cterm, const void *vbuf, int b
if (y == CURR_MINY) if (y == CURR_MINY)
break; break;
x = CURR_MINX; x = CURR_MINX;
GOTOXY(x, k-1); GOTOXY(x, y-1);
} }
else else
GOTOXY(--x, k); GOTOXY(--x, y);
if(x < CURR_MAXX) { if(x < CURR_MAXX) {
sx = x; sx = x;
sy = y; sy = y;
......
...@@ -814,6 +814,7 @@ void printf_trunc(char *dst, size_t dstsz, char *fmt, char *path) ...@@ -814,6 +814,7 @@ void printf_trunc(char *dst, size_t dstsz, char *fmt, char *path)
mangled[remain_len - 3] = '.'; mangled[remain_len - 3] = '.';
mangled[remain_len - 4] = '.'; mangled[remain_len - 4] = '.';
sprintf(dst, fmt, mangled); sprintf(dst, fmt, mangled);
free(mangled);
} }
else else
sprintf(dst, fmt, "<Long>"); sprintf(dst, fmt, "<Long>");
...@@ -2085,7 +2086,7 @@ static bool edit_comment(struct bbslist *list, char *listpath) ...@@ -2085,7 +2086,7 @@ static bool edit_comment(struct bbslist *list, char *listpath)
str_list_t inifile = NULL; str_list_t inifile = NULL;
int ch; int ch;
bool ret = false; bool ret = false;
char *old; char *old = NULL;
int i; int i;
if (list == NULL) if (list == NULL)
...@@ -2136,6 +2137,7 @@ static bool edit_comment(struct bbslist *list, char *listpath) ...@@ -2136,6 +2137,7 @@ static bool edit_comment(struct bbslist *list, char *listpath)
} }
done: done:
free(old);
if (inifile != NULL) { if (inifile != NULL) {
if ((listfile = fopen(listpath,"w")) != NULL) { if ((listfile = fopen(listpath,"w")) != NULL) {
iniWriteFile(listfile, inifile); iniWriteFile(listfile, inifile);
......
...@@ -7733,7 +7733,7 @@ unmap_rip_x(int x) ...@@ -7733,7 +7733,7 @@ unmap_rip_x(int x)
rip.xunmap[i] = roundl(((double)i) * rip.x_dim / rip.x_max); rip.xunmap[i] = roundl(((double)i) * rip.x_dim / rip.x_max);
} }
if (x >= rip.x_dim) if (x >= rip.x_dim)
x = rip.x_dim; x = rip.x_dim - 1;
return rip.xunmap[x]; return rip.xunmap[x];
} }
   
...@@ -7754,7 +7754,7 @@ unmap_rip_y(int y) ...@@ -7754,7 +7754,7 @@ unmap_rip_y(int y)
rip.yunmap[i] = roundl(((double)i) * rip.y_dim / rip.y_max); rip.yunmap[i] = roundl(((double)i) * rip.y_dim / rip.y_max);
} }
if (y >= rip.y_dim) if (y >= rip.y_dim)
y = rip.y_dim; y = rip.y_dim - 1;
return rip.yunmap[y]; return rip.yunmap[y];
} }
   
...@@ -10164,6 +10164,7 @@ rip_bezier(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int c ...@@ -10164,6 +10164,7 @@ rip_bezier(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int c
for (j = 2; j < i; j += 2) { for (j = 2; j < i; j += 2) {
set_line(targets[j - 2], targets[j - 1], targets[j], targets[j + 1], fg, rip.line_pattern, rip.line_width); set_line(targets[j - 2], targets[j - 1], targets[j], targets[j + 1], fg, rip.line_pattern, rip.line_width);
} }
free(targets);
} }
   
static void static void
......
...@@ -17,7 +17,7 @@ SOCKET rlogin_sock=INVALID_SOCKET; ...@@ -17,7 +17,7 @@ SOCKET rlogin_sock=INVALID_SOCKET;
#endif #endif
void rlogin_input_thread(void *args) void rlogin_input_thread(void *args)
{ {
int rd; int rd = 0;
int buffered; int buffered;
size_t buffer; size_t buffer;
......
...@@ -277,8 +277,8 @@ void update_status(struct bbslist *bbs, int speed, int ooii_mode) ...@@ -277,8 +277,8 @@ void update_status(struct bbslist *bbs, int speed, int ooii_mode)
int oldscroll; int oldscroll;
int olddmc=hold_update; int olddmc=hold_update;
struct text_info txtinfo; struct text_info txtinfo;
int now; time_t now;
static int lastupd=0; static time_t lastupd=0;
static int oldspeed=0; static int oldspeed=0;
int timeon; int timeon;
char sep; char sep;
...@@ -316,7 +316,12 @@ void update_status(struct bbslist *bbs, int speed, int ooii_mode) ...@@ -316,7 +316,12 @@ void update_status(struct bbslist *bbs, int speed, int ooii_mode)
} }
lastupd=now; lastupd=now;
oldspeed=speed; oldspeed=speed;
timeon=now - bbs->connected; if (now > (bbs->connected + 359999))
timeon = 350000;
else if (now < bbs->connected)
timeon = 0;
else
timeon=(int)(now - bbs->connected);
gettextinfo(&txtinfo); gettextinfo(&txtinfo);
oldscroll=_wscroll; oldscroll=_wscroll;
hold_update=TRUE; hold_update=TRUE;
...@@ -1276,7 +1281,8 @@ void xmodem_progress(void* cbdata, unsigned block_num, int64_t offset, int64_t f ...@@ -1276,7 +1281,8 @@ void xmodem_progress(void* cbdata, unsigned block_num, int64_t offset, int64_t f
{ {
uint64_t total_blocks; uint64_t total_blocks;
unsigned cps; unsigned cps;
int l; int i;
uint64_t l;
time_t t; time_t t;
time_t now; time_t now;
static time_t last_progress; static time_t last_progress;
...@@ -1312,7 +1318,7 @@ void xmodem_progress(void* cbdata, unsigned block_num, int64_t offset, int64_t f ...@@ -1312,7 +1318,7 @@ void xmodem_progress(void* cbdata, unsigned block_num, int64_t offset, int64_t f
,offset); ,offset);
clreol(); clreol();
cputs("\r\n"); cputs("\r\n");
cprintf("Time: %lu:%02lu/%lu:%02lu %u cps" cprintf("Time: %lu:%02lu/%" PRIu64 ":%02" PRIu64 " %u cps"
,(ulong)(t/60L) ,(ulong)(t/60L)
,(ulong)(t%60L) ,(ulong)(t%60L)
,(ulong)(l/60L) ,(ulong)(l/60L)
...@@ -1323,15 +1329,19 @@ void xmodem_progress(void* cbdata, unsigned block_num, int64_t offset, int64_t f ...@@ -1323,15 +1329,19 @@ void xmodem_progress(void* cbdata, unsigned block_num, int64_t offset, int64_t f
cputs("\r\n"); cputs("\r\n");
cprintf("%*s%3d%%\r\n", TRANSFER_WIN_WIDTH/2-5, "" cprintf("%*s%3d%%\r\n", TRANSFER_WIN_WIDTH/2-5, ""
,fsize?(long)(((float)offset/(float)fsize)*100.0):100); ,fsize?(long)(((float)offset/(float)fsize)*100.0):100);
l = fsize?(long)(((float)offset/(float)fsize)*60.0):60; i = fsize?(((float)offset/(float)fsize)*60.0):60;
cprintf("[%*.*s%*s]", l, l, if (i < 0)
i = 0;
else if (i > 60)
i = 60;
cprintf("[%*.*s%*s]", i, i,
"\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1" "\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1"
"\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1" "\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1"
"\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1" "\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1"
"\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1" "\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1"
"\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1" "\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1"
"\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1" "\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1"
, 60-l, ""); , 60-i, "");
} else if((*(xm->mode))&YMODEM) { } else if((*(xm->mode))&YMODEM) {
cprintf("Block (%lu%s): %lu Byte: %"PRId64 cprintf("Block (%lu%s): %lu Byte: %"PRId64
,xm->block_size%1024L ? xm->block_size: xm->block_size/1024L ,xm->block_size%1024L ? xm->block_size: xm->block_size/1024L
...@@ -1350,15 +1360,19 @@ void xmodem_progress(void* cbdata, unsigned block_num, int64_t offset, int64_t f ...@@ -1350,15 +1360,19 @@ void xmodem_progress(void* cbdata, unsigned block_num, int64_t offset, int64_t f
cputs("\r\n"); cputs("\r\n");
cprintf("%*s%3d%%\r\n", TRANSFER_WIN_WIDTH/2-5, "" cprintf("%*s%3d%%\r\n", TRANSFER_WIN_WIDTH/2-5, ""
,fsize?(long)(((float)offset/(float)fsize)*100.0):100); ,fsize?(long)(((float)offset/(float)fsize)*100.0):100);
l = fsize?(long)(((float)offset/(float)fsize)*60.0):60; i = fsize?(long)(((float)offset/(float)fsize)*60.0):60;
cprintf("[%*.*s%*s]", l, l, if (i < 0)
i = 0;
else if (i > 60)
i = 60;
cprintf("[%*.*s%*s]", i, i,
"\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1" "\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1"
"\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1" "\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1"
"\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1" "\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1"
"\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1" "\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1"
"\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1" "\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1"
"\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1" "\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1\xb1"
, 60-l, ""); , 60-i, "");
} else { /* XModem receive */ } else { /* XModem receive */
cprintf("Block (%lu%s): %lu Byte: %"PRId64 cprintf("Block (%lu%s): %lu Byte: %"PRId64
,xm->block_size%1024L ? xm->block_size: xm->block_size/1024L ,xm->block_size%1024L ? xm->block_size: xm->block_size/1024L
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment