diff options
author | Karl Berry <karl@freefriends.org> | 2007-10-22 00:43:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2007-10-22 00:43:13 +0000 |
commit | 8de839b61d52fa141a812cbc0bc68555fab63e18 (patch) | |
tree | 070709ce44b41d67c5ab4a33b7f4c6acf35276ef /Build/source/texk/dvipsk | |
parent | bb5fa8d3a61725395fb2e078e52f4ede24b33ae9 (diff) |
no hardwired buffer length
git-svn-id: svn://tug.org/texlive/trunk@5254 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipsk')
-rw-r--r-- | Build/source/texk/dvipsk/ChangeLog | 6 | ||||
-rw-r--r-- | Build/source/texk/dvipsk/hps.c | 60 |
2 files changed, 45 insertions, 21 deletions
diff --git a/Build/source/texk/dvipsk/ChangeLog b/Build/source/texk/dvipsk/ChangeLog index f74be113d2e..4841aaee27c 100644 --- a/Build/source/texk/dvipsk/ChangeLog +++ b/Build/source/texk/dvipsk/ChangeLog @@ -1,3 +1,9 @@ +2007-10-22 Karl Berry <karl@tug.org> + + * hps.c (stamp_external, stamp_hps): protext against long strings. + From Bastien Roucaries via Norbert, 21 Oct 2007 13:22:19, + Debian bug 447081. + 2007-10-12 Karl Berry <karl@tug.org> * resident.c (i): declare as int, in case tfmload() returns 65536 diff --git a/Build/source/texk/dvipsk/hps.c b/Build/source/texk/dvipsk/hps.c index 89a9aed96f5..8348a170e67 100644 --- a/Build/source/texk/dvipsk/hps.c +++ b/Build/source/texk/dvipsk/hps.c @@ -441,19 +441,28 @@ int href_name_match P2C(char *, h, char *, n) void stamp_hps P1C(Hps_link *, pl) { - char tmpbuf[200] ; + char * tmpbuf; if (pl == NULL) { - error("Null pointer, oh no!") ; + error("stamp_hps: null pl pointer, oh no!") ; return ; - } else { - /* print out the proper pdfm with local page info only - * target info will be in the target dictionary */ - (void)sprintf(tmpbuf, - " (%s) [[%.0f %.0f %.0f %.0f] [%i %i %i [%i %i]] [%.0f %.0f %.0f]] pdfm ", pl->title, pl->rect.llx, pl->rect.lly, pl->rect.urx, pl->rect.ury, - pl->border[0], pl->border[1], pl->border[2], pl->border[3],pl->border[4], - pl->color[0], pl->color[1], pl->color[2]) ; - cmdout(tmpbuf) ; - } + } + if(pl->title == NULL) { + error("stamp_hps: null pl->title pointer, oh no!") ; + return ; + } + + tmpbuf = (char *) xmalloc(strlen(pl->title)+200); + + /* print out the proper pdfm with local page info only + * target info will be in the target dictionary */ + (void)sprintf(tmpbuf, + " (%s) [[%.0f %.0f %.0f %.0f] [%i %i %i [%i %i]] [%.0f %.0f %.0f]] pdfm ", + pl->title, pl->rect.llx, pl->rect.lly, pl->rect.urx, pl->rect.ury, + pl->border[0], pl->border[1], pl->border[2], pl->border[3],pl->border[4], + pl->color[0], pl->color[1], pl->color[2]) ; + cmdout(tmpbuf) ; + free(tmpbuf); + } @@ -462,18 +471,27 @@ void stamp_hps P1C(Hps_link *, pl) */ void stamp_external P2C(char *, s, Hps_link *, pl) { - char tmpbuf[200]; + char *tmpbuf; if (pl == NULL) { - error("Null pointer, oh no!") ; + error("stamp_external: null pl pointer, oh no!") ; return ; - } else { - /* print out the proper pdfm with local page info only - * target info will be in the target dictionary */ - (void)sprintf(tmpbuf," [[%.0f %.0f %.0f %.0f] [%i %i %i [%i %i]] [%.0f %.0f %.0f]] (%s) pdfm ", pl->rect.llx, pl->rect.lly, pl->rect.urx, pl->rect.ury, - pl->border[0], pl->border[1], pl->border[2], pl->border[3],pl->border[4], - pl->color[0], pl->color[1], pl->color[2], s) ; - cmdout(tmpbuf) ; - } + } + + if (s == NULL) { + error("stamp_external: null s pointer, oh no!") ; + return ; + } + + tmpbuf = (char *) xmalloc(strlen(s) + 200); + + /* print out the proper pdfm with local page info only + * target info will be in the target dictionary */ + (void)sprintf(tmpbuf," [[%.0f %.0f %.0f %.0f] [%i %i %i [%i %i]] [%.0f %.0f %.0f]] (%s) pdfm ", + pl->rect.llx, pl->rect.lly, pl->rect.urx, pl->rect.ury, + pl->border[0], pl->border[1], pl->border[2], pl->border[3],pl->border[4], + pl->color[0], pl->color[1], pl->color[2], s) ; + cmdout(tmpbuf) ; + free(tmpbuf); } void finish_hps P1H(void) { |