Re: [gnet-dev] gnet_base64_decode does only partial decode



On Monday 30 May 2005 13:43, Siddhartha Jain wrote:

> [root opensims progs]# ./b64 TVpLRVJORUwzMi5...
> act=MZKERNEL32.DLL len=57
>
> [root opensims progs]# echo TVpLRVJORUwzMi5... | base64 -d
> MZKERNEL32.DLLLoadLibraryAGetProcAddressSymantecS
>
> 'base64' is the program I picked up from:
> http://www.fourmilab.ch/webtools/base64/
>
> What am I missing?

==> act=MZKERNEL32.DLL len=57

len is 57, so the problem is not that gnet_base64_decode() only does parts of 
the decoding. The problem is simply that there is an embedded \0 character 
between 'MZKERNEL32.DLL' and 'LoadLibraryAGetProcAddressSymantecS', and 
g_print() assumes that the string ends with the first \0 character. So the 
rest is there in memory, but just isn't printed, that's all.

The reason why it's printed with your base64 program is probably that it does 
something like write(1, bin, lens2), which means the embedded 0 is sent as 
well (1=stdout file descriptor).

Cheers
 -Tim



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]