summaryrefslogtreecommitdiff
path: root/misc/kdeedu3/patches/patch-ao
blob: db42e083dc7f3b5bcc5d0d30d4931485fe8eb8ca (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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
$NetBSD: patch-ao,v 1.1 2005/02/20 11:31:11 markd Exp $

--- kstars/kstars/indi/lilxml.c.orig	2004-06-25 21:10:04.000000000 +1200
+++ kstars/kstars/indi/lilxml.c	2005-02-19 15:01:32.000000000 +1300
@@ -32,6 +32,7 @@
 #include <ctype.h>
 
 #include "lilxml.h"
+#include "indicom.h"
 
 static int oneXMLchar (LilXML *lp, int c, char errmsg[]);
 static void initParser(LilXML *lp);
@@ -156,7 +157,7 @@
 
 	/* EOF? */
 	if (newc == 0) {
-	    sprintf (errmsg, "Line %d: XML EOF", lp->ln);
+	    snprintf (errmsg, ERRMSG_SIZE, "Line %d: XML EOF", lp->ln);
 	    initParser(lp);
 	    return (NULL);
 	}
@@ -344,7 +345,7 @@
 /* search ep for an attribute with the given name and return its value.
  * return "" if not found.
  */
-char *
+const char *
 findXMLAttValu (XMLEle *ep, char *name)
 {
 	XMLAtt *a = findXMLAtt (ep, name);
@@ -428,7 +429,7 @@
 		growString (&lp->ce->tag, c);
 		lp->cs = INTAG;
 	    } else if (!isspace(c)) {
-		sprintf (errmsg, "Line %d: Bogus tag char %c", lp->ln, c);
+		snprintf (errmsg, ERRMSG_SIZE, "Line %d: Bogus tag char %c", lp->ln, c);
 		return (-1);
 	    }
 	    break;
@@ -454,7 +455,7 @@
 		growString (&lp->ce->at[lp->ce->nat-1]->name, c);
 		lp->cs = INATTRN;
 	    } else if (!isspace(c)) {
-		sprintf (errmsg, "Line %d: Bogus leading attr name char: %c",
+		snprintf (errmsg, ERRMSG_SIZE, "Line %d: Bogus leading attr name char: %c",
 								    lp->ln, c);
 		return (-1);
 	    }
@@ -467,7 +468,7 @@
 		popXMLEle(lp);
 		lp->cs = LOOK4CON;
 	    } else {
-		sprintf (errmsg, "Line %d: Bogus char %c before >", lp->ln, c);
+		snprintf (errmsg, ERRMSG_SIZE, "Line %d: Bogus char %c before >", lp->ln, c);
 		return (-1);
 	    }
 	    break;
@@ -478,7 +479,7 @@
 	    else if (isspace(c) || c == '=')
 		lp->cs = LOOK4ATTRV;
 	    else {
-		sprintf (errmsg, "Line %d: Bogus attr name char: %c", lp->ln,c);
+		snprintf (errmsg, ERRMSG_SIZE, "Line %d: Bogus attr name char: %c", lp->ln,c);
 		return (-1);
 	    }
 	    break;
@@ -489,7 +490,7 @@
 		growString (&lp->ce->at[lp->ce->nat-1]->valu, '\0');
 		lp->cs = INATTRV;
 	    } else if (!(isspace(c) || c == '=')) {
-		sprintf (errmsg, "Line %d: No value for attribute %s", lp->ln,
+		snprintf (errmsg, ERRMSG_SIZE, "Line %d: No value for attribute %.100s", lp->ln,
 					    lp->ce->at[lp->ce->nat-1]->name);
 		return (-1);
 	    }
@@ -547,7 +548,7 @@
 		growString (&lp->endtag, c);
 		lp->cs = INCLOSETAG;
 	    } else if (!isspace(c)) {
-		sprintf (errmsg, "Line %d: Bogus preend tag char %c", lp->ln,c);
+		snprintf (errmsg, ERRMSG_SIZE, "Line %d: Bogus preend tag char %c", lp->ln,c);
 		return (-1);
 	    }
 	    break;
@@ -557,7 +558,7 @@
 		growString (&lp->endtag, c);
 	    else if (c == '>') {
 		if (strcmp (lp->ce->tag, lp->endtag)) {
-		    sprintf (errmsg,"Line %d: closing tag %s does not match %s",
+		    snprintf (errmsg, ERRMSG_SIZE, "Line %d: closing tag %.64s does not match %.64s",
 					    lp->ln, lp->endtag, lp->ce->tag);
 		    return (-1);
 		} else if (lp->ce->pe) {
@@ -566,7 +567,7 @@
 		} else
 		    return (1);		/* yes! */
 	    } else if (!isspace(c)) {
-		sprintf (errmsg, "Line %d: Bogus end tag char %c", lp->ln, c);
+		snprintf (errmsg, ERRMSG_SIZE, "Line %d: Bogus end tag char %c", lp->ln, c);
 		return (-1);
 	    }
 	    break;
@@ -723,7 +724,7 @@
 main (int ac, char *av[])
 {
 	LilXML *lp = newLilXML();
-	char errmsg[1024];
+	char errmsg[ERRMSG_SIZE];
 	XMLEle *root;
 
 	root = readXMLFile (stdin, lp, errmsg);