From 68750bb5ebfaf77887385824819f579578b95e70 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 23 Oct 2018 22:43:58 +0000 Subject: avoid possible strlen on null ptr git-svn-id: svn://tug.org/texlive/trunk@48980 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvipsk/ChangeLog | 6 ++++++ Build/source/texk/dvipsk/writet1.c | 6 ++++-- Build/source/texk/web2c/pdftexdir/ChangeLog | 6 ++++++ Build/source/texk/web2c/pdftexdir/writet1.c | 6 ++++-- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Build/source/texk/dvipsk/ChangeLog b/Build/source/texk/dvipsk/ChangeLog index bbce8fb3f86..27fbdfa82c1 100644 --- a/Build/source/texk/dvipsk/ChangeLog +++ b/Build/source/texk/dvipsk/ChangeLog @@ -1,3 +1,9 @@ +2018-10-24 Karl Berry + + * writet1.c (t1_check_unusual_charstring): don't call + strlen(t1_buf_array) if it is null. + From Luigi, 22 Oct 2018 22:43:03. + 2018-09-18 Nick Roessler * writet1.c (t1_check_unusual_charstring): protect against buffer diff --git a/Build/source/texk/dvipsk/writet1.c b/Build/source/texk/dvipsk/writet1.c index 3b478b90084..73c03018c49 100644 --- a/Build/source/texk/dvipsk/writet1.c +++ b/Build/source/texk/dvipsk/writet1.c @@ -1,5 +1,5 @@ /* -Copyright 1996-2013 Han The Thanh +Copyright 1996-2018 Han The Thanh This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1449,7 +1449,9 @@ static void t1_check_unusual_charstring(void) *(strend(t1_buf_array) - 1) = ' '; t1_getline(); - alloc_array(t1_buf, strlen(t1_line_array) + strlen(t1_buf_array) + 1, T1_BUF_SIZE); + alloc_array(t1_buf, strlen(t1_line_array) + + (t1_buf_array ? strlen(t1_buf_array) + 1 : 0), + T1_BUF_SIZE); strcat(t1_buf_array, t1_line_array); alloc_array(t1_line, strlen(t1_buf_array) + 1, T1_BUF_SIZE); strcpy(t1_line_array, t1_buf_array); diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog index e0a7b5e0ce1..346d7a48bfd 100644 --- a/Build/source/texk/web2c/pdftexdir/ChangeLog +++ b/Build/source/texk/web2c/pdftexdir/ChangeLog @@ -1,3 +1,9 @@ +2018-10-24 Karl Berry + + * writet1.c (t1_check_unusual_charstring): don't call + strlen(t1_buf_array) if it is null. + From Luigi, 22 Oct 2018 22:43:03. + 2018-10-22 Akira Kakuto * pdftosrc-newpoppler.cc: Add a comment that it works upto diff --git a/Build/source/texk/web2c/pdftexdir/writet1.c b/Build/source/texk/web2c/pdftexdir/writet1.c index 8cfc2616ca3..079ac369d7d 100644 --- a/Build/source/texk/web2c/pdftexdir/writet1.c +++ b/Build/source/texk/web2c/pdftexdir/writet1.c @@ -1,5 +1,5 @@ /* -Copyright 1996-2014 Han The Thanh +Copyright 1996-2018 Han The Thanh This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1598,7 +1598,9 @@ static void t1_check_unusual_charstring(void) *(strend(t1_buf_array) - 1) = ' '; t1_getline(); - alloc_array(t1_buf, strlen(t1_line_array) + strlen(t1_buf_array) + 1, T1_BUF_SIZE); + alloc_array(t1_buf, strlen(t1_line_array) + + (t1_buf_array ? strlen(t1_buf_array) + 1 : 0), + T1_BUF_SIZE); strcat(t1_buf_array, t1_line_array); alloc_array(t1_line, strlen(t1_buf_array) + 1, T1_BUF_SIZE); strcpy(t1_line_array, t1_buf_array); -- cgit v1.2.3