Replace occurences of strcpy and strcat by strlcpy and strlcat. At both places, while improbable, it was possible to get string overflows.

CID 9043, 9044


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40650 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Saint-Pierre 2011-02-24 01:23:21 +00:00
parent 0e952e21c3
commit b754759693
2 changed files with 4 additions and 4 deletions

View File

@ -2996,7 +2996,7 @@ FSCreateNewFolderIn(const node_ref *dirNode, entry_ref *newRef,
status_t result = dir.InitCheck();
if (result == B_OK) {
char name[B_FILE_NAME_LENGTH];
strcpy(name, B_TRANSLATE("New folder"));
strlcpy(name, B_TRANSLATE("New folder"), sizeof(name));
int32 fnum = 1;
while (dir.Contains(name)) {

View File

@ -1319,9 +1319,9 @@ FindPanel::PushMimeType(BQuery *query) const
if (strcmp(kAllMimeTypes, type)) {
// add an asterisk if we are searching for a supertype
char buffer[B_FILE_NAME_LENGTH];
if (strchr(type,'/') == NULL) {
strcpy(buffer,type);
strcat(buffer,"/*");
if (strchr(type, '/') == NULL) {
strlcpy(buffer, type, sizeof(buffer));
strlcat(buffer, "/*", sizeof(buffer));
type = buffer;
}