* Fix some overlapping strcpy's (thx @earada!)

This commit is contained in:
Nibble 2010-11-20 18:35:40 +01:00
parent 71978e186f
commit e8a09f4e87
2 changed files with 12 additions and 4 deletions

View File

@ -281,8 +281,10 @@ R_API int r_flag_set(RFlag *fo, const char *name, ut64 addr, ut32 size, int dup)
}
R_API void r_flag_item_rename(RFlagItem *item, const char *name) {
int len;
strncpy (item->name, name, R_FLAG_NAME_SIZE);
strncpy (item->name, r_str_chop (item->name), R_FLAG_NAME_SIZE);
len = R_MIN (R_FLAG_NAME_SIZE, strlen (r_str_chop (item->name)) + 1);
memmove (item->name, r_str_chop (item->name), len);
item->name[R_FLAG_NAME_SIZE-1]='\0';
item->namehash = r_str_hash64 (item->name);
}

View File

@ -129,16 +129,22 @@ static int samefile(const char *a, const char *b) {
char *sa = strdup(a);
char *sb = strdup(b);
char *ptr;
int ret;
int ret, len;
if (sa != NULL && sb != NULL) {
do {
ptr = strstr(sa, "//");
if (ptr) strcpy(ptr, ptr+1);
if (ptr) {
len = strlen (ptr+1) + 1;
memmove (ptr, ptr+1, len);
}
} while(ptr);
do {
ptr = strstr(sb, "//");
if (ptr) strcpy(ptr, ptr+1);
if (ptr) {
len = strlen (ptr+1) + 1;
memmove (ptr, ptr+1, len);
}
} while(ptr);
ret = strcmp(sa,sb)?R_FALSE:R_TRUE;
}