CID 6331, 6333, 6334, 6335 SECURE_CODING

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40677 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jonas Sundström
2011-02-25 06:43:39 +00:00
parent 85b2f68b69
commit 70da0d8639
+4 -4
View File
@@ -333,7 +333,7 @@ query_for_app(const char* signature, entry_ref* appRef)
else { else {
// second pass, create a case insensitive query string // second pass, create a case insensitive query string
char string[B_MIME_TYPE_LENGTH * 4]; char string[B_MIME_TYPE_LENGTH * 4];
strcpy(string, "application/"); strlcpy(string, "application/", sizeof(string));
int32 length = strlen(string); int32 length = strlen(string);
const char* from = signature + length; const char* from = signature + length;
@@ -2496,7 +2496,7 @@ BRoster::_ResolveApp(const char* inType, entry_ref* ref,
if (_appSig) { if (_appSig) {
// there's no warranty, that appMeta is valid // there's no warranty, that appMeta is valid
if (appMeta.IsValid()) if (appMeta.IsValid())
strcpy(_appSig, appMeta.Type()); strlcpy(_appSig, appMeta.Type(), B_MIME_TYPE_LENGTH);
else else
_appSig[0] = '\0'; _appSig[0] = '\0';
} }
@@ -2708,7 +2708,7 @@ BRoster::_TranslateType(const char* mimeType, BMimeType* appMeta,
} }
} else { } else {
// The type is not installed. We assume it is an app signature. // The type is not installed. We assume it is an app signature.
strcpy(primarySignature, mimeType); strlcpy(primarySignature, mimeType, sizeof(primarySignature));
} }
} }
@@ -2876,7 +2876,7 @@ BRoster::_GetFileType(const entry_ref* file, BNodeInfo* nodeInfo,
if (!type.IsValid()) if (!type.IsValid())
return B_BAD_VALUE; return B_BAD_VALUE;
strcpy(mimeType, type.Type()); strlcpy(mimeType, type.Type(), B_MIME_TYPE_LENGTH);
} }
return B_OK; return B_OK;