Package: fenris
Version: 0.07-m2+build3245-1
Tags: patch
Below there's a patch that corrects these problems and
some others which came out later.
Please keep in mind that I made this patch without any knowledge
of binutils and bfd.
--
Tommaso Moroni
[EMAIL PROTECTED]
diff -ruN fenris-0.07-m2+build3245/dress.c fenris-0.07-m2+build3245.new/dress.c
--- fenris-0.07-m2+build3245/dress.c 2005-08-06 15:34:12.000000000 +0000
+++ fenris-0.07-m2+build3245.new/dress.c 2005-08-06 15:33:57.000000000
+0000
@@ -198,28 +198,28 @@
debug("[*] Code section at 0x%08x - 0x%08x, offset %d in the file.\n",
(int)ss->vma,
- (int)(bfd_get_start_address(b)+ss->_raw_size),
+ (int)(bfd_get_start_address(b)+bfd_get_section_size(ss)),
(int)ss->filepos);
debug("[*] For your initial breakpoint, use *0x%x\n",(int)ss->vma);
fi=open(argv[optind],O_RDONLY);
if (!fi) fatal("cannot open input file");
- if (!(code=malloc(ss->_raw_size+5))) fatal("malloc failed");
+ if (!(code=malloc(bfd_get_section_size(ss)+5))) fatal("malloc failed");
lseek(fi,ss->filepos,SEEK_SET);
- if (read(fi,code,ss->_raw_size)!=ss->_raw_size) fatal("read failed");
+ if (read(fi,code,bfd_get_section_size(ss))!=bfd_get_section_size(ss))
fatal("read failed");
close(fi);
debug("[+] Locating CALLs... ");
// This will catch many false positives, but who cares?
- for (i=0;i<ss->_raw_size-5;i++) {
+ for (i=0;i<bfd_get_section_size(ss)-5;i++) {
if (code[i]==0xe8) {
int a,got=0;
unsigned int daddr;
int *off=(int*)&code[i+1];
daddr=i+(*off)+5;
- if (daddr > ss->_raw_size) continue; // Nah, stupid.
+ if (daddr > bfd_get_section_size(ss)) continue; // Nah, stupid.
for (a=0;a<ctop;a++) if (calls[a] == daddr) { got=1; break; } // Dupe.
if (!got) {
calls[ctop]=daddr;
@@ -354,7 +354,7 @@
while (s) {
int siz;
if (s->name[0]=='.') debug("%s ",s->name);
- siz = bfd_get_section_size_before_reloc(s);
+ siz = bfd_get_section_size(s);
if (siz>=0)
if (bfd_get_section_flags(ibfd, s) & SEC_HAS_CONTENTS) {
void* memhunk = malloc(siz);
diff -ruN fenris-0.07-m2+build3245/ragnarok.c
fenris-0.07-m2+build3245.new/ragnarok.c
--- fenris-0.07-m2+build3245/ragnarok.c 2005-08-06 15:34:12.000000000 +0000
+++ fenris-0.07-m2+build3245.new/ragnarok.c 2005-08-06 15:33:58.000000000
+0000
@@ -480,7 +480,7 @@
if (topfd<i) topfd=i;
}
-getmeout:
+getmeout: ;
}
@@ -1247,7 +1247,7 @@
migrated=1;
bounceback=1; goto handle_migration;
-knowncont:
+knowncont: ;
} else if (strstr(x,"\\ merge")) {
x+=14;
if (sscanf(x,"%x:%d %x:%d (%*[^)]) ->
%x:%d",&q,&q,&q,&q,&addr,&len)<6) continue;
@@ -1426,7 +1426,7 @@
migrated=1;
bounceback=2; goto handle_migration;
-sysccont:
+sysccont: ;
} else if (strstr(x,"\\ merge")) {
x+=14;
if (sscanf(x,"%x:%d %x:%d (%*[^)]) ->
%x:%d",&q,&q,&q,&q,&addr,&len)<6) continue;