aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llurl.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:50 -0500
committerJacek Antonelli2008-08-15 23:44:50 -0500
commit89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch)
treebcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/newview/llurl.cpp
parentSecond Life viewer sources 1.13.3.2 (diff)
downloadmeta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz
Second Life viewer sources 1.14.0.0
Diffstat (limited to 'linden/indra/newview/llurl.cpp')
-rw-r--r--linden/indra/newview/llurl.cpp75
1 files changed, 43 insertions, 32 deletions
diff --git a/linden/indra/newview/llurl.cpp b/linden/indra/newview/llurl.cpp
index d3ad8e2..0374ec9 100644
--- a/linden/indra/newview/llurl.cpp
+++ b/linden/indra/newview/llurl.cpp
@@ -66,9 +66,10 @@ void LLURL::init(const char * url)
66 mExtension[0] = '\0'; 66 mExtension[0] = '\0';
67 mTag[0] = '\0'; 67 mTag[0] = '\0';
68 68
69 char url_copy[MAX_STRING]; 69 char url_copy[MAX_STRING]; /* Flawfinder: ignore */
70 70
71 strcpy (url_copy,url); 71 strncpy (url_copy,url, MAX_STRING -1); /* Flawfinder: ignore */
72 url_copy[MAX_STRING -1] = '\0';
72 73
73 char *parse; 74 char *parse;
74 char *leftover_url = url_copy; 75 char *leftover_url = url_copy;
@@ -77,7 +78,8 @@ void LLURL::init(const char * url)
77 // copy and lop off tag 78 // copy and lop off tag
78 if ((parse = strchr(url_copy,'#'))) 79 if ((parse = strchr(url_copy,'#')))
79 { 80 {
80 strcpy(mTag,parse+1); 81 strncpy(mTag,parse+1, LL_MAX_PATH -1); /* Flawfinder: ignore */
82 mTag[LL_MAX_PATH -1] = '\0';
81 *parse = '\0'; 83 *parse = '\0';
82 } 84 }
83 85
@@ -85,7 +87,8 @@ void LLURL::init(const char * url)
85 if ((parse = strchr(url_copy,':'))) 87 if ((parse = strchr(url_copy,':')))
86 { 88 {
87 *parse = '\0'; 89 *parse = '\0';
88 strcpy(mURI,leftover_url); 90 strncpy(mURI,leftover_url, LL_MAX_PATH -1); /* Flawfinder: ignore */
91 mURI[LL_MAX_PATH -1] = '\0';
89 leftover_url = parse + 1; 92 leftover_url = parse + 1;
90 } 93 }
91 94
@@ -95,14 +98,15 @@ void LLURL::init(const char * url)
95 leftover_url += 2; // skip the "//" 98 leftover_url += 2; // skip the "//"
96 99
97 span = strcspn(leftover_url, "/"); 100 span = strcspn(leftover_url, "/");
98 strncat(mAuthority,leftover_url,span); 101 strncat(mAuthority,leftover_url,span); /* Flawfinder: ignore */
99 leftover_url += span; 102 leftover_url += span;
100 } 103 }
101 104
102 if ((parse = strrchr(leftover_url,'.'))) 105 if ((parse = strrchr(leftover_url,'.')))
103 { 106 {
104 // copy and lop off extension 107 // copy and lop off extension
105 strcpy(mExtension,parse+1); 108 strncpy(mExtension,parse+1, LL_MAX_PATH -1); /* Flawfinder: ignore */
109 mExtension[LL_MAX_PATH -1] = '\0';
106 *parse = '\0'; 110 *parse = '\0';
107 } 111 }
108 112
@@ -116,11 +120,13 @@ void LLURL::init(const char * url)
116 } 120 }
117 121
118 // copy and lop off filename 122 // copy and lop off filename
119 strcpy(mFilename,parse); 123 strncpy(mFilename,parse, LL_MAX_PATH -1);/* Flawfinder: ignore */
124 mFilename[LL_MAX_PATH -1] = '\0';
120 *parse = '\0'; 125 *parse = '\0';
121 126
122 // what's left should be the path 127 // what's left should be the path
123 strcpy(mPath,leftover_url); 128 strncpy(mPath,leftover_url, LL_MAX_PATH -1); /* Flawfinder: ignore */
129 mPath[LL_MAX_PATH -1] = '\0';
124 130
125// llinfos << url << " decomposed into: " << llendl; 131// llinfos << url << " decomposed into: " << llendl;
126// llinfos << " URI : <" << mURI << ">" << llendl; 132// llinfos << " URI : <" << mURI << ">" << llendl;
@@ -169,42 +175,43 @@ bool LLURL::operator!=(const LLURL& rhs) const
169 175
170const char * LLURL::getFQURL() const 176const char * LLURL::getFQURL() const
171{ 177{
172 char fqurl[LL_MAX_PATH]; 178 char fqurl[LL_MAX_PATH]; /* Flawfinder: ignore */
173 179
174 fqurl[0] = '\0'; 180 fqurl[0] = '\0';
175 181
176 if (mURI[0]) 182 if (mURI[0])
177 { 183 {
178 strcat(fqurl,mURI); 184 strncat(fqurl,mURI, LL_MAX_PATH - strlen(fqurl) -1); /* Flawfinder: ignore */
179 strcat(fqurl,":"); 185 strcat(fqurl,":"); /* Flawfinder: ignore */
180 if (mAuthority[0]) 186 if (mAuthority[0])
181 { 187 {
182 strcat(fqurl,"//"); 188 strcat(fqurl,"//"); /* Flawfinder: ignore */
183 } 189 }
184 } 190 }
185 191
186 if (mAuthority[0]) 192 if (mAuthority[0])
187 { 193 {
188 strcat(fqurl,mAuthority); 194 strncat(fqurl,mAuthority, LL_MAX_PATH - strlen(fqurl) -1); /* Flawfinder: ignore */
189 } 195 }
190 196
191 strcat(fqurl,mPath); 197 strncat(fqurl,mPath, LL_MAX_PATH - strlen(fqurl) -1); /* Flawfinder: ignore */
192 198
193 strcat(fqurl,mFilename); 199 strncat(fqurl,mFilename, LL_MAX_PATH - strlen(fqurl) -1); /* Flawfinder: ignore */
194 200
195 if (mExtension[0]) 201 if (mExtension[0])
196 { 202 {
197 strcat(fqurl,"."); 203 strcat(fqurl,"."); /* Flawfinder: ignore */
198 strcat(fqurl,mExtension); 204 strncat(fqurl,mExtension, LL_MAX_PATH - strlen(fqurl) -1); /* Flawfinder: ignore */
199 } 205 }
200 206
201 if (mTag[0]) 207 if (mTag[0])
202 { 208 {
203 strcat(fqurl,"#"); 209 strcat(fqurl,"#"); /* Flawfinder: ignore */
204 strcat(fqurl,mTag); 210 strncat(fqurl,mTag, LL_MAX_PATH - strlen(fqurl) -1); /* Flawfinder: ignore */
205 } 211 }
206 212
207 strcpy(LLURL::sReturnString,fqurl); 213 strncpy(LLURL::sReturnString,fqurl, LL_MAX_PATH -1); /* Flawfinder: ignore */
214 LLURL::sReturnString[LL_MAX_PATH -1] = '\0';
208 215
209 return(LLURL::sReturnString); 216 return(LLURL::sReturnString);
210} 217}
@@ -212,16 +219,18 @@ const char * LLURL::getFQURL() const
212 219
213const char* LLURL::updateRelativePath(const LLURL &url) 220const char* LLURL::updateRelativePath(const LLURL &url)
214{ 221{
215 char new_path[LL_MAX_PATH]; 222 char new_path[LL_MAX_PATH]; /* Flawfinder: ignore */
216 char tmp_path[LL_MAX_PATH]; 223 char tmp_path[LL_MAX_PATH]; /* Flawfinder: ignore */
217 224
218 char *parse; 225 char *parse;
219 226
220 if (mPath[0] != '/') 227 if (mPath[0] != '/')
221 { 228 {
222 //start with existing path 229 //start with existing path
223 strcpy (new_path,url.mPath); 230 strncpy (new_path,url.mPath, LL_MAX_PATH -1); /* Flawfinder: ignore */
224 strcpy (tmp_path,mPath); 231 new_path[LL_MAX_PATH -1] = '\0';
232 strncpy (tmp_path,mPath, LL_MAX_PATH -1); /* Flawfinder: ignore */
233 tmp_path[LL_MAX_PATH -1] = '\0';
225 234
226 parse = strtok(tmp_path,"/"); 235 parse = strtok(tmp_path,"/");
227 while (parse) 236 while (parse)
@@ -246,28 +255,30 @@ const char* LLURL::updateRelativePath(const LLURL &url)
246 } 255 }
247 else 256 else
248 { 257 {
249 strcat(new_path,"../"); 258 strcat(new_path,"../"); /* Flawfinder: ignore */
250 } 259 }
251 260
252 } 261 }
253 else 262 else
254 { 263 {
255 strcat(new_path,parse); 264 strncat(new_path,parse, LL_MAX_PATH - strlen(new_path) -1 ); /* Flawfinder: ignore */
256 strcat(new_path,"/"); 265 strcat(new_path,"/"); /* Flawfinder: ignore */
257 } 266 }
258 parse = strtok(NULL,"/"); 267 parse = strtok(NULL,"/");
259 } 268 }
260 strcpy(mPath,new_path); 269 strncpy(mPath,new_path, LL_MAX_PATH -1); /* Flawfinder: ignore */
270 mPath[LL_MAX_PATH -1] = '\0';
261 } 271 }
262 return mPath; 272 return mPath;
263} 273}
264 274
265const char * LLURL::getFullPath() 275const char * LLURL::getFullPath()
266{ 276{
267 strcpy(LLURL::sReturnString,mPath); 277 strncpy(LLURL::sReturnString,mPath, LL_MAX_PATH -1); /* Flawfinder: ignore */
268 strcat(LLURL::sReturnString,mFilename); 278 LLURL::sReturnString[LL_MAX_PATH -1] = '\0';
269 strcat(LLURL::sReturnString,"."); 279 strncat(LLURL::sReturnString,mFilename, LL_MAX_PATH - strlen(LLURL::sReturnString) -1); /* Flawfinder: ignore */
270 strcat(LLURL::sReturnString,mExtension); 280 strcat(LLURL::sReturnString,"."); /* Flawfinder: ignore */
281 strncat(LLURL::sReturnString,mExtension, LL_MAX_PATH - strlen(LLURL::sReturnString) -1); /* Flawfinder: ignore */
271 return(sReturnString); 282 return(sReturnString);
272} 283}
273 284