mirror of
https://github.com/rizinorg/rizin.git
synced 2026-10-12 02:21:57 +00:00
rz-debug: terminate the map start token on NetBSD, OpenBSD and DragonFly
rz_debug_native_map_get() splits a "<start>-<end>" region by copying the
tail into region2, but never terminated region at the '-'. That was
harmless while rz_num_get() stopped at the first character it could not
read; it no longer does, so the start token is now evaluated as a whole
expression:
0x7fc8124c4000-7fc81278d000 -> syntax error, 0
0x400000-0405000 -> 0x3df600, the end read as C octal
Every map then gets a wrong start address. linux_map_get() was fixed when
the parser changed; these three copies were missed. kfbsd.c reads the two
bounds as separate sscanf fields and is unaffected, as is the FreeBSD
map_get, which does not parse text at all.
This commit is contained in:
committed by
Florian Märkl
parent
18d414f7d6
commit
842cde6138
@@ -325,6 +325,8 @@ static RzList /*<RzDebugMap *>*/ *rz_debug_native_map_get(RzDebug *dbg) {
|
||||
continue;
|
||||
}
|
||||
strncpy(®ion2[2], pos_c + 1, sizeof(region2) - 2 - 1);
|
||||
// Terminate the start token at the '-'
|
||||
*pos_c = 0;
|
||||
|
||||
if (!*name) {
|
||||
snprintf(name, sizeof(name), "unk%d", unk++);
|
||||
@@ -573,4 +575,4 @@ RzDebugPlugin rz_debug_plugin_native = {
|
||||
.breakpoint = rz_debug_native_bp,
|
||||
.drx = rz_debug_native_drx,
|
||||
.gcore = rz_debug_gcore,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -345,6 +345,8 @@ static RzList /*<RzDebugMap *>*/ *rz_debug_native_map_get(RzDebug *dbg) {
|
||||
continue;
|
||||
}
|
||||
strncpy(®ion2[2], pos_c + 1, sizeof(region2) - 2 - 1);
|
||||
// Terminate the start token at the '-'
|
||||
*pos_c = 0;
|
||||
|
||||
if (!*name) {
|
||||
snprintf(name, sizeof(name), "unk%d", unk++);
|
||||
@@ -598,4 +600,4 @@ RzDebugPlugin rz_debug_plugin_native = {
|
||||
.breakpoint = rz_debug_native_bp,
|
||||
.drx = rz_debug_native_drx,
|
||||
.gcore = rz_debug_gcore,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -348,6 +348,8 @@ static RzList /*<RzDebugMap *>*/ *rz_debug_native_map_get(RzDebug *dbg) {
|
||||
continue;
|
||||
}
|
||||
strncpy(®ion2[2], pos_c + 1, sizeof(region2) - 2 - 1);
|
||||
// Terminate the start token at the '-'
|
||||
*pos_c = 0;
|
||||
|
||||
if (!*name) {
|
||||
snprintf(name, sizeof(name), "unk%d", unk++);
|
||||
|
||||
Reference in New Issue
Block a user