summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--render/layout.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/render/layout.c b/render/layout.c
index f80be7d..7928f41 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -958,7 +958,8 @@ bool layout_line(struct box *first, int width, int *y,
if (!c2)
return false;
memcpy(c2, split_box, sizeof *c2);
- c2->text = strdup(split_box->text + space + 1);
+ c2->text = strndup(split_box->text + space + 1,
+ split_box->length - (space + 1));
if (!c2->text)
return false;
c2->length = split_box->length - (space + 1);
@@ -1000,7 +1001,8 @@ bool layout_line(struct box *first, int width, int *y,
if (!c2)
return false;
memcpy(c2, split_box, sizeof *c2);
- c2->text = strdup(split_box->text + space + 1);
+ c2->text = strndup(split_box->text + space + 1,
+ split_box->length - (space + 1));
if (!c2->text)
return false;
c2->length = split_box->length - (space + 1);