comparison src/loadso/macos/SDL_sysloadso.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
40 Ptr mainAddr; 40 Ptr mainAddr;
41 Str255 errName; 41 Str255 errName;
42 OSErr error; 42 OSErr error;
43 char psofile[512]; 43 char psofile[512];
44 44
45 SDL_strncpy(psofile, sofile, SDL_TABLESIZE(psofile)); 45 SDL_strlcpy(psofile, sofile, SDL_arraysize(psofile));
46 psofile[SDL_TABLESIZE(psofile)-1] = '\0';
47 error = GetSharedLibrary(C2PStr(psofile), kCompiledCFragArch, 46 error = GetSharedLibrary(C2PStr(psofile), kCompiledCFragArch,
48 kLoadCFrag, &library_id, &mainAddr, errName); 47 kLoadCFrag, &library_id, &mainAddr, errName);
49 switch (error) { 48 switch (error) {
50 case noErr: 49 case noErr:
51 loaderror = NULL; 50 loaderror = NULL;
78 const char *loaderror = NULL; 77 const char *loaderror = NULL;
79 CFragSymbolClass class; 78 CFragSymbolClass class;
80 CFragConnectionID library_id = (CFragConnectionID)handle; 79 CFragConnectionID library_id = (CFragConnectionID)handle;
81 char pname[512]; 80 char pname[512];
82 81
83 SDL_strncpy(pname, name, SDL_TABLESIZE(pname)); 82 SDL_strlcpy(pname, name, SDL_arraysize(pname));
84 pname[SDL_TABLESIZE(pname)-1] = '\0';
85 if ( FindSymbol(library_id, C2PStr(pname), 83 if ( FindSymbol(library_id, C2PStr(pname),
86 (char **)&symbol, &class) != noErr ) { 84 (char **)&symbol, &class) != noErr ) {
87 loaderror = "Symbol not found"; 85 loaderror = "Symbol not found";
88 } 86 }
89 87