summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2004-06-22 17:52:40 (GMT)
committer James Bursa <james@netsurf-browser.org>2004-06-22 17:52:40 (GMT)
commit2a23749fc678cdad43c2e3b5149010904d6c2528 (patch)
tree35583b9467101a5d2e585a0c13c0aca46f0ba77f
parenta9365b50771b3624249bb2e4d7a650918a0e4fe3 (diff)
downloadnetsurf-2a23749fc678cdad43c2e3b5149010904d6c2528.tar.gz
netsurf-2a23749fc678cdad43c2e3b5149010904d6c2528.tar.bz2
[project @ 2004-06-22 17:52:40 by bursa]
Fix some strdup()s on non-terminated strings. svn path=/import/netsurf/; revision=992
-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);