]> git.pld-linux.org Git - packages/xv.git/blame - xv-longname.patch
- added jasper patch (don't use internal functions or hacks)
[packages/xv.git] / xv-longname.patch
CommitLineData
c1f0ee65
JR
1From: Michael Rausch <M.Rausch@Ernie.MI.Uni-Koeln.DE>
2Subject: bug in xv visual schnauzer
3
4while using xv's visual schnauzer, I ran across some problems with rather
5long file names. Namely these were (spurious) segmentation faults when
6generation icons or selecting icons with the rubber-band.
7The problem turned out to be a strncpy() without appending a terminating
8null byte in case the limiting length was reached. Appended to this mail
9you'll find a set of context diffs where this specific and other possible
10occurances of the same bug are fixed.
11I think it will be not too hard to integrate the patches into your actual
12working version if patch should fail on them. Speaking of which, when do
13you think we can expect a new (bigger, better, etc.) version of xv?
14
15Ciao
16 Michael
17
18---*snip*---*snip*---*snip*--
19
20diff -ru /tmp/xv-3.10a.orig/xvbrowse.c xv-3.10a/xvbrowse.c
21--- /tmp/xv-3.10a.orig/xvbrowse.c Thu Jan 19 18:49:17 1995
22+++ xv-3.10a/xvbrowse.c Mon Feb 5 23:46:28 1996
23@@ -956,6 +956,7 @@
24 char *str;
25 {
26 strncpy(br->dispstr, str, (size_t) 256);
27+ br->dispstr[255] = '\0';
28 drawBrowStr(br);
29 XFlush(theDisp);
30 }
31@@ -1490,6 +1491,7 @@
32 if (StringWidth(str) > ISPACE_WIDE-6) {
33 int dotpos;
34 strncpy(tmpstr, str, (size_t) 56);
35+ tmpstr[56] = '\0'; /* MR: otherwise it dies on long file names */
36 dotpos = strlen(tmpstr);
37 strcat(tmpstr,"...");
38
39@@ -1505,7 +1507,7 @@
40 nstr = tmpstr;
41 }
42 else nstr = str;
43-
44+
45
46 /* draw the title */
47 sw = StringWidth(nstr);
48diff -ru /tmp/xv-3.10a.orig/xvdir.c xv-3.10a/xvdir.c
49--- /tmp/xv-3.10a.orig/xvdir.c Tue Jan 3 22:21:39 1995
50+++ xv-3.10a/xvdir.c Mon Feb 5 21:49:21 1996
51@@ -1200,6 +1200,7 @@
52 char *st;
53 {
54 strncpy(deffname, st, (size_t) MAXFNLEN-1);
55+ deffname[MAXFNLEN-1] = '\0';
56 setFName(st);
57 }
58
59diff -ru /tmp/xv-3.10a.orig/xvpopup.c xv-3.10a/xvpopup.c
60--- /tmp/xv-3.10a.orig/xvpopup.c Thu Jan 19 19:09:31 1995
61+++ xv-3.10a/xvpopup.c Mon Feb 5 21:50:13 1996
62@@ -560,6 +560,7 @@
63 nams[*lenp] = (char *) malloc((size_t) 32);
64 if (!nams[*lenp]) { free(vals[*lenp]); continue; }
65 strncpy(nams[*lenp], vals[*lenp], (size_t) 31);
66+ nams[*lenp][31] = '\0';
67 }
68
69 if (strlen(nams[*lenp]) > (size_t) 20) { /* fix long names */
70diff -ru /tmp/xv-3.10a.orig/xvtext.c xv-3.10a/xvtext.c
71--- /tmp/xv-3.10a.orig/xvtext.c Sat Jan 14 00:46:28 1995
72+++ xv-3.10a/xvtext.c Mon Feb 5 21:50:54 1996
73@@ -293,6 +293,7 @@
74 tv->textlen = len;
75 tv->freeonclose = freeonclose;
76 strncpy(tv->title, title, (size_t) TITLELEN-1);
77+ tv->title[TITLELEN-1] = '\0';
78
79 computeText(tv); /* compute # lines and linestarts array */
80
81---*snap*---*snap*---*snap*--
This page took 0.032798 seconds and 4 git commands to generate.