Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11video.c @ 1379:c0a74f199ecf
Use only safe string functions
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 19 Feb 2006 23:46:34 +0000 |
parents | 19418e4422cb |
children | d910939febfa |
comparison
equal
deleted
inserted
replaced
1378:dc0e13e7e1ae | 1379:c0a74f199ecf |
---|---|
273 #endif | 273 #endif |
274 | 274 |
275 /* First allow environment variable override */ | 275 /* First allow environment variable override */ |
276 spot = SDL_getenv("SDL_VIDEO_X11_WMCLASS"); | 276 spot = SDL_getenv("SDL_VIDEO_X11_WMCLASS"); |
277 if ( spot ) { | 277 if ( spot ) { |
278 SDL_strncpy(classname, spot, maxlen); | 278 SDL_strlcpy(classname, spot, maxlen); |
279 return classname; | 279 return classname; |
280 } | 280 } |
281 | 281 |
282 /* Next look at the application's executable name */ | 282 /* Next look at the application's executable name */ |
283 #if defined(linux) || defined(__FreeBSD__) | 283 #if defined(linux) || defined(__FreeBSD__) |
291 linksize = readlink(procfile, linkfile, sizeof(linkfile)-1); | 291 linksize = readlink(procfile, linkfile, sizeof(linkfile)-1); |
292 if ( linksize > 0 ) { | 292 if ( linksize > 0 ) { |
293 linkfile[linksize] = '\0'; | 293 linkfile[linksize] = '\0'; |
294 spot = SDL_strrchr(linkfile, '/'); | 294 spot = SDL_strrchr(linkfile, '/'); |
295 if ( spot ) { | 295 if ( spot ) { |
296 SDL_strncpy(classname, spot+1, maxlen); | 296 SDL_strlcpy(classname, spot+1, maxlen); |
297 } else { | 297 } else { |
298 SDL_strncpy(classname, linkfile, maxlen); | 298 SDL_strlcpy(classname, linkfile, maxlen); |
299 } | 299 } |
300 return classname; | 300 return classname; |
301 } | 301 } |
302 #endif /* linux */ | 302 #endif /* linux */ |
303 | 303 |
304 /* Finally use the default we've used forever */ | 304 /* Finally use the default we've used forever */ |
305 SDL_strncpy(classname, "SDL_App", maxlen); | 305 SDL_strlcpy(classname, "SDL_App", maxlen); |
306 return classname; | 306 return classname; |
307 } | 307 } |
308 | 308 |
309 /* Create auxiliary (toplevel) windows with the current visual */ | 309 /* Create auxiliary (toplevel) windows with the current visual */ |
310 static void create_aux_windows(_THIS) | 310 static void create_aux_windows(_THIS) |