View Full Version : Labelmaster feature request
sigi
January 16th, 2005, 07:42
two things that would be nice:
first: if labels from files could automatically be limited to length that ollydbg can take (256?). labels larger cause a crash. (undecorated names tend to be very long).
second: being able to supply a different base adress (since dlls are sometimes relocated).
labelmaster is a really nice plugin, very usefull...
focht
January 16th, 2005, 12:47
Hi,
well for the case of "automatic limitation" the plugin author is not to be blamed because it's a shortcoming/inconsistency of ollydbg plugin interface iteself.
The plugin uses:
int Quickinsertname(ulong addr,int type,char *name);
(though same applies to Insertname())
which takes a "char*" as 3rd param.
There is no "max length" argument nor even a size limit mentioned in plugin docs.
Though one could "guess" the limitation by looking at other plugin functions which use "TEXTLEN" for char buffers.
For the "crash" case its not really ollydbg's fault but a plugin bug.
The stack gets overwritten due to large input line.
offending code (shortened)
<-- snip -->
....
while(ReadLine(fd,buf,bufsize) > 0) {
sscanf(buf, "%x %[\x20-\x7e]", &addr, label);
<-- snip -->
While the readline() call succeeds (bufsize limits the line reading) the sscanf() call will overwrite the stack due to insufficient "label" buffer.
Simple calculation:
char buf[550];
int bufsize = 550;
char label[512];
There is a "size" gap between line buffer and label buffer.
If you assume text file lines like "<hex addr> <label>" where the addr takes say 8 ascii bytes and 1 space the label length might exceed 512 bytes thus sscanf() overwriting buffer bounds.
Fix: Make label buffer size equal to buflen at least or use "%<maxlength>s" format string style.
>second: being able to supply a different base adress (since dlls are sometimes relocated).
I assume you mean the re-based address should be applied to imported labels?
Well that needs some change in stored file format, because relative virtual addresses (RVA) are needed for this.
One could save the image base as first line and all labels/comments using "<rva> <label>" style.
A feature extension like rebased image address can be then accomplished easily.
Regards
sigi
January 31st, 2005, 17:32
now that's accurate information, thank's a lot...
Powered by vBulletin® Version 4.2.2 Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.