From 2a23749fc678cdad43c2e3b5149010904d6c2528 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Tue, 22 Jun 2004 17:52:40 +0000 Subject: [project @ 2004-06-22 17:52:40 by bursa] Fix some strdup()s on non-terminated strings. svn path=/import/netsurf/; revision=992 --- render/layout.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/render/layout.c b/render/layout.c index f80be7dc2..7928f4122 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); -- cgit v1.2.3