Peter Stuge wrote:
Matthias Wenzel wrote:
+++ b/phoenix.c
..
@@ -117,10 +117,10 @@ PhoenixModule(unsigned char *BIOSImage, int BIOSLength, int Offset)
ModuleName = PhoenixModuleNameGet(Module->Type); if (ModuleName) {
- filename = malloc(strlen(ModuleName) + 7);
- filename = malloc(strlen(ModuleName) + 7 + 3); sprintf(filename, "%s_%1d.rom", ModuleName, Module->Id); } else {
- filename = malloc(9);
- filename = malloc(9 + 3); sprintf(filename, "%02X_%1d.rom", Module->Type, Module->Id); }
If everything (also Type) is u8 then the above is 1 byte extra :) but better safe than sorry!
Both are u8, and yes, I was conservative as some C-libs (other than glibc) might add a sign with the "%1d". Maybe we should write "%1u" or even "%.3" to be clearer.
mazzoo