From 75c6c76be7736b994e40cbd64aa0ad3280ba5e17 Mon Sep 17 00:00:00 2001 From: dsl Date: Mon, 2 Aug 2004 18:47:52 +0000 Subject: [PATCH] Fix (I hope) the bounding checks against the source window. --- lib/libcurses/copywin.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libcurses/copywin.c b/lib/libcurses/copywin.c index 3c712ddccb5d..b1579fb81f1a 100644 --- a/lib/libcurses/copywin.c +++ b/lib/libcurses/copywin.c @@ -1,4 +1,4 @@ -/* $NetBSD: copywin.c,v 1.10 2004/08/01 21:48:24 dsl Exp $ */ +/* $NetBSD: copywin.c,v 1.11 2004/08/02 18:47:52 dsl Exp $ */ /*- * Copyright (c) 1998-1999 Brett Lymn @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: copywin.c,v 1.10 2004/08/01 21:48:24 dsl Exp $"); +__RCSID("$NetBSD: copywin.c,v 1.11 2004/08/02 18:47:52 dsl Exp $"); #endif /* not lint */ #include @@ -79,16 +79,16 @@ int copywin(const WINDOW *srcwin, WINDOW *dstwin, if (dmaxcol >= dstwin->maxx) dmaxcol = dstwin->maxx - 1; if (smincol + (dmaxcol - dmincol) >= srcwin->maxx) - dmaxcol = srcwin->maxx + dmincol - smincol; + dmaxcol = srcwin->maxx + dmincol - smincol - 1; if (dmaxcol < dmincol) /* nothing in the intersection */ return OK; /* Bound dmaxrow for both windows (should be ok for dstwin) */ - if (dmaxrow >= dstwin->maxx) + if (dmaxrow >= dstwin->maxy) dmaxrow = dstwin->maxy - 1; if (sminrow + (dmaxrow - dminrow) >= srcwin->maxy) - dmaxrow = srcwin->maxx + dminrow - sminrow; + dmaxrow = srcwin->maxy + dminrow - sminrow - 1; #ifdef DEBUG __CTRACE("copywin %s mode: from (%d,%d) to (%d,%d-%d,%d)\n",