diff options
-rw-r--r-- | mbbsd/io.c | 11 | ||||
-rw-r--r-- | mbbsd/screen.c | 1 |
2 files changed, 8 insertions, 4 deletions
@@ -291,16 +291,19 @@ igetch(void) if (currutmp->msgs[0].pid && WATERMODE(WATER_OFO) && wmofo == NOTREPLYING) { int y, x, my_newfd; - screenline_t *screen0 = calloc(t_lines, sizeof(screenline_t)); - memcpy(screen0, big_picture, t_lines * sizeof(screenline_t)); + void *screen0; + + screen0=malloc(screen_backupsize(t_lines, big_picture)); + screen_backup(t_lines, big_picture, screen0); getyx(&y, &x); + my_newfd = i_newfd; i_newfd = 0; my_write2(); - memcpy(big_picture, screen0, t_lines * sizeof(screenline_t)); + screen_restore(t_lines, big_picture, screen0); + free(screen0); i_newfd = my_newfd; move(y, x); - free(screen0); redoscr(); continue; } else if (!WATERMODE(WATER_OFO)) { diff --git a/mbbsd/screen.c b/mbbsd/screen.c index 7435716f..bf744931 100644 --- a/mbbsd/screen.c +++ b/mbbsd/screen.c @@ -505,6 +505,7 @@ standend(void) } } +// XXX race: signal handler write to screen, data larger than allocated buf void screen_backup(int len, const screenline_t *bp, void *buf) { int i; |