aboutsummaryrefslogtreecommitdiff
path: root/recipes/termcap/termcap-2.0.8/011_all_termcap-AAARGH.patch
blob: 1ba98a00654db34e3670609f97b4d012f53b6c7d (plain)
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
--- termcap-2.0.8/termcap.c.aaargh
+++ termcap-2.0.8/termcap.c
@@ -469,10 +469,12 @@
   if (is_malloced && term_entry) free(term_entry);

   /* Do we already have a buffer? */
-  if (sp) {
-	maxlen = tgetent_bufsize - 1;
-	is_malloced = 0;
-  } else {
+  /* No we don't. I don't care if they pass us a few gigabytes
+   * of storage. We're ignoring it. */
+  /* if (sp) {
+   *	maxlen = tgetent_bufsize - 1;
+   *	is_malloced = 0;
+   * } else { */
	/* Count how many bytes we need. */
	count = strlen(s) + 1;
	for(i = l; i; i = i->next)
@@ -483,7 +485,7 @@
	sp = xmalloc(count);
	maxlen = count + 32; /* Just a lot. */
	is_malloced = 1;
-  }
+/*  } */

   /* Save buffer into static variable (yuk!) */
   term_entry = sp;
@@ -587,14 +589,16 @@
   s = find_cap(term_entry, cap, '=');
   if (s == NULL) return(s);

+  /* Yawn. Let's ignore bufp, too. */
   /* Where to put the result. */
-  if (bufp == (char **)NULL) {
+  /* if (bufp == (char **)NULL) { */
	for(sp = s; *sp != ':' && *sp; sp++) {
		if (*sp =='\\' && sp[1] == ':') sp++;
	}
	ret = xmalloc(sp - s + 1);
-  } else
-	ret = *bufp;
+  /* } else
+   *	ret = *bufp;
+   */
   r = ret;

   /* Translate escaped characters and hat-notation. */
@@ -628,7 +632,7 @@
   *r++ = 0;

   /* Do we need to update bufp? */
-  if (bufp) *bufp = r;
+ /*  if (bufp) *bufp = r; */

   return(ret);
 }