diff --git a/src/conio/cterm.c b/src/conio/cterm.c
index 5a8783b0d4feedf30195c7963766b492f10396e6..7c532ddd51605953c6d0cbf00671e21234771f51 100644
--- a/src/conio/cterm.c
+++ b/src/conio/cterm.c
@@ -5346,10 +5346,10 @@ CIOLIBEXPORT char* cterm_write(struct cterminal * cterm, const void *vbuf, int b
 									if (y == CURR_MINY)
 										break;
 									x = CURR_MINX;
-									GOTOXY(x, k-1);
+									GOTOXY(x, y-1);
 								}
 								else
-									GOTOXY(--x, k);
+									GOTOXY(--x, y);
 								if(x < CURR_MAXX) {
 									sx = x;
 									sy = y;
diff --git a/src/syncterm/bbslist.c b/src/syncterm/bbslist.c
index a1efe2a7641cf03070117dd3c7ff0c6969a3ce07..ba6c5683ff9d8e51535a8054c586a136a0aaa562 100644
--- a/src/syncterm/bbslist.c
+++ b/src/syncterm/bbslist.c
@@ -814,6 +814,7 @@ void printf_trunc(char *dst, size_t dstsz, char *fmt, char *path)
 			mangled[remain_len - 3] = '.';
 			mangled[remain_len - 4] = '.';
 			sprintf(dst, fmt, mangled);
+			free(mangled);
 		}
 		else
 			sprintf(dst, fmt, "<Long>");
@@ -2085,7 +2086,7 @@ static bool edit_comment(struct bbslist *list, char *listpath)
 	str_list_t inifile = NULL;
 	int ch;
 	bool ret = false;
-	char *old;
+	char *old = NULL;
 	int i;
 
 	if (list == NULL)
@@ -2136,6 +2137,7 @@ static bool edit_comment(struct bbslist *list, char *listpath)
 	}
 
 done:
+	free(old);
 	if (inifile != NULL) {
 		if ((listfile = fopen(listpath,"w")) != NULL) {
 			iniWriteFile(listfile, inifile);
diff --git a/src/syncterm/ripper.c b/src/syncterm/ripper.c
index 837204d4577b956a85f034898d163b108b77a2ce..6a77bac2fd017e8e6de4c44ee38938381db21043 100644
--- a/src/syncterm/ripper.c
+++ b/src/syncterm/ripper.c
@@ -7733,7 +7733,7 @@ unmap_rip_x(int x)
 			rip.xunmap[i] = roundl(((double)i) * rip.x_dim / rip.x_max);
 	}
 	if (x >= rip.x_dim)
-		x = rip.x_dim;
+		x = rip.x_dim - 1;
 	return rip.xunmap[x];
 }
 
@@ -7754,7 +7754,7 @@ unmap_rip_y(int y)
 			rip.yunmap[i] = roundl(((double)i) * rip.y_dim / rip.y_max);
 	}
 	if (y >= rip.y_dim)
-		y = rip.y_dim;
+		y = rip.y_dim - 1;
 	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
 	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);
 	}
+	free(targets);
 }
 
 static void
diff --git a/src/syncterm/rlogin.c b/src/syncterm/rlogin.c
index 1fbe1df717e29dbc764f8828bacff6e4d180196d..e309b1eae87742f45d53e78f306cb1b7972ab181 100644
--- a/src/syncterm/rlogin.c
+++ b/src/syncterm/rlogin.c
@@ -17,7 +17,7 @@ SOCKET rlogin_sock=INVALID_SOCKET;
 #endif
 void rlogin_input_thread(void *args)
 {
-	int		rd;
+	int		rd = 0;
 	int	buffered;
 	size_t	buffer;
 
diff --git a/src/syncterm/term.c b/src/syncterm/term.c
index f865de2b49223a9df909257bca48b7ced0e8923c..091012c397b79ce52cc3c0fca1daecd45bea25bf 100644
--- a/src/syncterm/term.c
+++ b/src/syncterm/term.c
@@ -277,8 +277,8 @@ void update_status(struct bbslist *bbs, int speed, int ooii_mode)
 	int oldscroll;
 	int olddmc=hold_update;
 	struct	text_info txtinfo;
-	int now;
-	static int lastupd=0;
+	time_t now;
+	static time_t lastupd=0;
 	static int oldspeed=0;
 	int	timeon;
 	char sep;
@@ -316,7 +316,12 @@ void update_status(struct bbslist *bbs, int speed, int ooii_mode)
 	}
 	lastupd=now;
 	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);
 	oldscroll=_wscroll;
 	hold_update=TRUE;
@@ -1276,7 +1281,8 @@ void xmodem_progress(void* cbdata, unsigned block_num, int64_t offset, int64_t f
 {
 	uint64_t	total_blocks;
 	unsigned	cps;
-	int			l;
+	int		i;
+	uint64_t	l;
 	time_t		t;
 	time_t		now;
 	static time_t last_progress;
@@ -1312,7 +1318,7 @@ void xmodem_progress(void* cbdata, unsigned block_num, int64_t offset, int64_t f
 				,offset);
 			clreol();
 			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)(l/60L)
@@ -1323,15 +1329,19 @@ void xmodem_progress(void* cbdata, unsigned block_num, int64_t offset, int64_t f
 			cputs("\r\n");
 			cprintf("%*s%3d%%\r\n", TRANSFER_WIN_WIDTH/2-5, ""
 				,fsize?(long)(((float)offset/(float)fsize)*100.0):100);
-			l = fsize?(long)(((float)offset/(float)fsize)*60.0):60;
-			cprintf("[%*.*s%*s]", l, l,
+			i = fsize?(((float)offset/(float)fsize)*60.0):60;
+			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"
-					, 60-l, "");
+					, 60-i, "");
 		} else if((*(xm->mode))&YMODEM) {
 			cprintf("Block (%lu%s): %lu  Byte: %"PRId64
 				,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
 			cputs("\r\n");
 			cprintf("%*s%3d%%\r\n", TRANSFER_WIN_WIDTH/2-5, ""
 				,fsize?(long)(((float)offset/(float)fsize)*100.0):100);
-			l = fsize?(long)(((float)offset/(float)fsize)*60.0):60;
-			cprintf("[%*.*s%*s]", l, l,
+			i = fsize?(long)(((float)offset/(float)fsize)*60.0):60;
+			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"
-					, 60-l, "");
+					, 60-i, "");
 		} else { /* XModem receive */
 			cprintf("Block (%lu%s): %lu  Byte: %"PRId64
 				,xm->block_size%1024L ? xm->block_size: xm->block_size/1024L