}
if (target_prefix) {
- bin->elf_path = g_build_path("/", target_prefix,
- path, NULL);
+ bin->elf_path = g_build_filename(target_prefix, path, NULL);
} else {
bin->elf_path = g_strdup(path);
}
* - Note type
*/
name_sz = (uint32_t) *buf;
+
+ /*
+ * Check the note name length. The name_sz field includes the
+ * terminating null byte.
+ */
+ if (name_sz != sizeof(BUILD_ID_NOTE_NAME)) {
+ goto invalid;
+ }
+
buf += sizeof(name_sz);
+ /* Ignore the note description size. */
buf += sizeof(desc_sz);
note_type = (uint32_t) *buf;
g_snprintf(&build_id_file[build_id_char_len], build_id_suffix_char_len,
BUILD_ID_SUFFIX);
- path = g_build_path("/", dbg_dir, BUILD_ID_SUBDIR, build_id_file, NULL);
+ path = g_build_filename(dbg_dir, BUILD_ID_SUBDIR, build_id_file, NULL);
if (!path) {
goto error;
}
* @param cu bt_dwarf_cu instance in which to look for the address
* @param addr The address for which to look for
* @param src_loc Out parameter, the source location (filename and
- * line number) for the address
+ * line number) for the address. Set only if the address
+ * is found and resolved successfully
+ *
* @returns 0 on success, -1 on failure
*/
static
line = dwarf_getsrc_die(die->dwarf_die, addr);
if (!line) {
- goto error;
+ /* This is not an error. The caller needs to keep looking. */
+ goto end;
}
ret = dwarf_lineaddr(line, &line_addr);
*src_loc = _src_loc;
}
+end:
return 0;
error: