mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-07 10:33:30 +00:00
* Fix some overlapping strcpy's (thx @earada!)
This commit is contained in:
parent
71978e186f
commit
e8a09f4e87
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user