summaryrefslogtreecommitdiff
path: root/shed.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@x1-nano.kaivo.local>2023-04-01 20:58:01 -0400
committerJakob Kaivo <jkk@x1-nano.kaivo.local>2023-04-01 20:58:01 -0400
commit713aa3cf266fd576cdfc68234812bb2743b6f808 (patch)
treef1a199827dff9e45b16fc0aeac1347a7807eb768 /shed.c
parent4c554a5723b9d14f2e715829c5827a5eba89011d (diff)
ensure returned string is NUL-terminated
Diffstat (limited to 'shed.c')
-rw-r--r--shed.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/shed.c b/shed.c
index a0cc554..c010cb1 100644
--- a/shed.c
+++ b/shed.c
@@ -60,6 +60,9 @@ struct shed *shed(struct shed *e)
}
} while (e->handle(e, &tio, c));
+ /* TODO: make sure this doesn't overflow */
+ e->cur->buf[e->cur->nread] = '\0';
+
tcsetattr(STDIN_FILENO, TCSADRAIN, &original_tio);
return e;
}