summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEivind Eklund <eivind@FreeBSD.org>1997-03-18 16:09:27 +0000
committerEivind Eklund <eivind@FreeBSD.org>1997-03-18 16:09:27 +0000
commit43ec585267be09db7f6c18d8c33a86485fabd011 (patch)
tree4f79a256c89d5233e7949339750ecbdacf1486a7
parent753da60320633bf92bb698ce3767a0d2e6d62a67 (diff)
Notes
-rw-r--r--lib/libtermcap/tgoto.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libtermcap/tgoto.c b/lib/libtermcap/tgoto.c
index ca493024f706..4088fa5f7ff3 100644
--- a/lib/libtermcap/tgoto.c
+++ b/lib/libtermcap/tgoto.c
@@ -174,7 +174,12 @@ casedot:
* to be the successor of tab.
*/
do {
- strcat(added, oncol ? (BC ? BC : "\b") : UP);
+ const char *extra;
+
+ extra = oncol ? (BC ? BC : "\b") : UP;
+ if (strlen(added) + strlen(extra) >= 10)
+ return ("OVERFLOW");
+ strcat(added, extra);
which++;
} while (which == '\n');
}
@@ -215,7 +220,7 @@ casedot:
goto toohard;
}
}
- if (dp+strlen(added)+1 > &result[MAXRETURNSIZE])
+ if (strlen(added) >= &result[MAXRETURNSIZE] - dp)
return ("OVERFLOW");
strcpy(dp, added);
return (result);