diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2007-10-18 09:34:54 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2007-10-18 09:34:54 +0300 |
commit | 8bcd871811ccea8b704264ce273843e7b1c508d1 (patch) | |
tree | 6a301b7543d1acc4aaade7eef4b529ad3a5b5c16 /tools | |
parent | abdc47d51cbd910f47d8415cadc93a5b94fcecf6 (diff) | |
download | rpm-8bcd871811ccea8b704264ce273843e7b1c508d1.tar.gz rpm-8bcd871811ccea8b704264ce273843e7b1c508d1.tar.bz2 rpm-8bcd871811ccea8b704264ce273843e7b1c508d1.zip |
debugedit mishandles empty DW_AT_comp_dir (Roland McGrath)
- fpc seems to produce DW_AT_comp_dir with value "" (empty string).
This is dubious, but debugedit makes it even worse by getting confused by it.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/debugedit.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/debugedit.c b/tools/debugedit.c index 920624197..13ed1e132 100644 --- a/tools/debugedit.c +++ b/tools/debugedit.c @@ -560,11 +560,16 @@ edit_dwarf2_line (DSO *dso, uint_32 off, char *comp_dir, int phase) } else { - memcpy (s, comp_dir, comp_dir_len); - s[comp_dir_len] = '/'; - memcpy (s + comp_dir_len + 1, dirt[value], dir_len); - s[comp_dir_len + 1 + dir_len] = '/'; - memcpy (s + comp_dir_len + 1 + dir_len + 1, file, file_len + 1); + char *p = s; + if (comp_dir_len != 0) + { + memcpy (s, comp_dir, comp_dir_len); + s[comp_dir_len] = '/'; + p += comp_dir_len + 1; + } + memcpy (p, dirt[value], dir_len); + p[dir_len] = '/'; + memcpy (p + dir_len + 1, file, file_len + 1); } canonicalize_path (s, s); if (list_file_fd != -1) |