1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
hps.c (stamp_external, stamp_hps): protext against long strings.
From Bastien Roucaries via Norbert, 21 Oct 2007 13:22:19,
Debian bug 447081.
Index: texk/dvipsk/hps.c
===================================================================
--- texk/dvipsk/hps.c (revision 5253)
+++ texk/dvipsk/hps.c (revision 5254)
@@ -441,20 +441,29 @@
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);
+
}
/* For external URL's, we just pass them through as a string. The hyperps
@@ -462,18 +471,27 @@
*/
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) {
|