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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
$NetBSD: patch-ar,v 1.1 2005/02/20 11:31:11 markd Exp $
--- kstars/kstars/indi/lx200driver.c.orig 2004-06-25 21:10:04.000000000 +1200
+++ kstars/kstars/indi/lx200driver.c
@@ -584,7 +584,7 @@ int setCommandInt(int data, const char *
char tempString[16];
- sprintf(tempString, "%s%d#", cmd, data);
+ snprintf(tempString, sizeof( tempString ), "%s%d#", cmd, data);
if (portWrite(tempString) < 0)
return -1;
@@ -596,7 +596,7 @@ int setMinElevationLimit(int min)
{
char tempString[16];
- sprintf(tempString, "#:Sh%02d#", min);
+ snprintf(tempString, sizeof( tempString ), "#:Sh%02d#", min);
return (setStandardProcedure(tempString));
}
@@ -605,7 +605,7 @@ int setMaxElevationLimit(int max)
{
char tempString[16];
- sprintf(tempString, "#:So%02d*#", max);
+ snprintf(tempString, sizeof( tempString ), "#:So%02d*#", max);
return (setStandardProcedure(tempString));
@@ -619,7 +619,7 @@ int setMaxSlewRate(int slewRate)
if (slewRate < 2 || slewRate > 8)
return -1;
- sprintf(tempString, "#:Sw%d#", slewRate);
+ snprintf(tempString, sizeof( tempString ), "#:Sw%d#", slewRate);
return (setStandardProcedure(tempString));
@@ -634,7 +634,7 @@ int setObjectRA(double ra)
getSexComponents(ra, &h, &m, &s);
- sprintf(tempString, "#:Sr %02d:%02d:%02d#", h, m, s);
+ snprintf(tempString, sizeof( tempString ), "#:Sr %02d:%02d:%02d#", h, m, s);
IDLog("Set Object RA String %s\n", tempString);
return (setStandardProcedure(tempString));
}
@@ -649,9 +649,9 @@ int setObjectDEC(double dec)
/* case with negative zero */
if (!d && dec < 0)
- sprintf(tempString, "#:Sd -%02d:%02d:%02d#", d, m, s);
+ snprintf(tempString, sizeof( tempString ), "#:Sd -%02d:%02d:%02d#", d, m, s);
else
- sprintf(tempString, "#:Sd %+03d:%02d:%02d#", d, m, s);
+ snprintf(tempString, sizeof( tempString ), "#:Sd %+03d:%02d:%02d#", d, m, s);
IDLog("Set Object DEC String %s\n", tempString);
@@ -663,7 +663,7 @@ int setCommandXYZ(int x, int y, int z, c
{
char tempString[16];
- sprintf(tempString, "%s %02d:%02d:%02d#", cmd, x, y, z);
+ snprintf(tempString, sizeof( tempString ), "%s %02d:%02d:%02d#", cmd, x, y, z);
return (setStandardProcedure(tempString));
}
@@ -698,7 +698,7 @@ int setCalenderDate(int dd, int mm, int
char boolRet[2];
yy = yy % 100;
- sprintf(tempString, "#:SC %02d/%02d/%02d#", mm, dd, yy);
+ snprintf(tempString, sizeof( tempString ), "#:SC %02d/%02d/%02d#", mm, dd, yy);
if (portWrite(tempString) < 0)
return -1;
@@ -725,7 +725,7 @@ int setUTCOffset(double hours)
char tempString[16];
/*TODO add fractions*/
- sprintf(tempString, "#:SG %+03d#", (int) hours);
+ snprintf(tempString, sizeof( tempString ), "#:SG %+03d#", (int) hours);
fprintf(stderr, "UTC string is %s\n", tempString);
@@ -740,7 +740,7 @@ int setSiteLongitude(double Long)
getSexComponents(Long, &d, &m, &s);
- sprintf(tempString, "#:Sg%03d:%02d#", d, m);
+ snprintf(tempString, sizeof( tempString ), "#:Sg%03d:%02d#", d, m);
return (setStandardProcedure(tempString));
}
@@ -752,7 +752,7 @@ int setSiteLatitude(double Lat)
getSexComponents(Lat, &d, &m, &s);
- sprintf(tempString, "#:St%+03d:%02d:%02d#", d, m, s);
+ snprintf(tempString, sizeof( tempString ), "#:St%+03d:%02d:%02d#", d, m, s);
return (setStandardProcedure(tempString));
}
@@ -764,7 +764,7 @@ int setObjAz(double az)
getSexComponents(az, &d, &m, &s);
- sprintf(tempString, "#:Sz%03d:%02d#", d, m);
+ snprintf(tempString, sizeof( tempString ), "#:Sz%03d:%02d#", d, m);
return (setStandardProcedure(tempString));
@@ -777,7 +777,7 @@ int setObjAlt(double alt)
getSexComponents(alt, &d, &m, &s);
- sprintf(tempString, "#:Sa%+02d*%02d#", d, m);
+ snprintf(tempString, sizeof( tempString ), "#:Sa%+02d*%02d#", d, m);
return (setStandardProcedure(tempString));
}
@@ -791,16 +791,16 @@ int setSiteName(char * siteName, int sit
switch (siteNum)
{
case 1:
- sprintf(tempString, "#:SM %s#", siteName);
+ snprintf(tempString, sizeof( tempString ), "#:SM %s#", siteName);
break;
case 2:
- sprintf(tempString, "#:SN %s#", siteName);
+ snprintf(tempString, sizeof( tempString ), "#:SN %s#", siteName);
break;
case 3:
- sprintf(tempString, "#:SO %s#", siteName);
+ snprintf(tempString, sizeof( tempString ), "#:SO %s#", siteName);
break;
case 4:
- sprintf(tempString, "#:SP %s#", siteName);
+ snprintf(tempString, sizeof( tempString ), "#:SP %s#", siteName);
break;
default:
return -1;
@@ -883,7 +883,7 @@ int setTrackFreq(double trackF)
{
char tempString[16];
- sprintf(tempString, "#:ST %04.1f#", trackF);
+ snprintf(tempString, sizeof( tempString ), "#:ST %04.1f#", trackF);
return (setStandardProcedure(tempString));
@@ -1044,13 +1044,13 @@ int selectCatalogObject(int catalog, int
switch (catalog)
{
case LX200_STAR_C:
- sprintf(tempString, "#:LS%d#", NNNN);
+ snprintf(tempString, sizeof( tempString ), "#:LS%d#", NNNN);
break;
case LX200_DEEPSKY_C:
- sprintf(tempString, "#:LC%d#", NNNN);
+ snprintf(tempString, sizeof( tempString ), "#:LC%d#", NNNN);
break;
case LX200_MESSIER_C:
- sprintf(tempString, "#:LM%d#", NNNN);
+ snprintf(tempString, sizeof( tempString ), "#:LM%d#", NNNN);
break;
default:
return -1;
@@ -1068,10 +1068,10 @@ int selectSubCatalog(int catalog, int su
switch (catalog)
{
case LX200_STAR_C:
- sprintf(tempString, "#:LsD%d#", subCatalog);
+ snprintf(tempString, sizeof( tempString ), "#:LsD%d#", subCatalog);
break;
case LX200_DEEPSKY_C:
- sprintf(tempString, "#:LoD%d#", subCatalog);
+ snprintf(tempString, sizeof( tempString ), "#:LoD%d#", subCatalog);
break;
case LX200_MESSIER_C:
return 1;
|