aboutsummaryrefslogtreecommitdiff
path: root/text.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-09-28 10:58:20 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-09-28 10:58:20 +0200
commit7bdfddc15768a1507b029578e408483efe51ba02 (patch)
tree471d3fe63a73f4a735b246f2869e16c6cf0bb72b /text.c
parente198d9e0672251f72af4cb3ccb32cdbf4d45be2d (diff)
downloadvis-7bdfddc15768a1507b029578e408483efe51ba02.tar.gz
vis-7bdfddc15768a1507b029578e408483efe51ba02.tar.xz
Improve argument validation in text_insert
Diffstat (limited to 'text.c')
-rw-r--r--text.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/text.c b/text.c
index fdcf1cf..650f095 100644
--- a/text.c
+++ b/text.c
@@ -504,6 +504,8 @@ static void change_free(Change *c) {
* \-+ <-- +-----+ <-- +---------------+ <-- +-/
*/
bool text_insert(Text *txt, size_t pos, const char *data, size_t len) {
+ if (len == 0)
+ return true;
if (pos > txt->size)
return false;
if (pos < txt->lines.pos)