Home page logo
/

wireshark logo Wireshark mailing list archives

Re: epan_base64_decode(): failure when string contains a NUL character
From: Uli Heilmeier <zeugs () heilmeier eu>
Date: Sun, 21 Apr 2013 22:22:47 +0200

Hi,

Thanks for both replies!
I did a complete clean-up of my code and now the decoded string is 14
bytes long. So the epan_base64_decode() function is working correct.

Sorry for the work and the confusion.

There is only one issue left: How can I split up this string. The
g_strsplit() function seems to don't accept NULL as a delimiter.

Thanks!
Uli

Am 20.04.13 11:55, schrieb Jakub Zawadzki:
Hi,

On Wed, Apr 17, 2013 at 10:27:42PM +0200, Uli Heilmeier wrote:
With the PLAIN mechanism the packet has a base64 encoded string containing:
[authorization user](\x00)[authentication user](\x00)[password]

For example:
dGVzdAB0ZXN0ADEyMzQ= contains test(NUL)test(NUL)1234

I tried to decode the base64 string with the epan_base64_decode() function
(from epan/base64.h). Unfortunately this fails. I only get a wrong three
bytes long string.
I guess the problem is the NUL character as a delimiter.

Do you have an idea if this is bug in the epan_base64_decode() function or
do I have to do the decoding another way?

From C interactive shell (gdb):

(gdb) call $x = (char *) strdup("dGVzdAB0ZXN0ADEyMzQ=")
$1 = 0x65b0e0 "dGVzdAB0ZXN0ADEyMzQ="
(gdb) call epan_base64_decode($x)
$2 = 14

(gdb) x/14c $x
0x65b0e0:       116 't' 101 'e' 115 's' 116 't' 0 '\000'        116 't' 101 'e' 115 's'
0x65b0e8:       116 't' 0 '\000'        49 '1'  50 '2'  51 '3'  52 '4'

(gdb) call $x
$3 = 0x65b0e0 "test"
(gdb) call $x + 5
$4 = 0x65b0e5 "test"
(gdb) call $x + 5 + 5
$5 = 0x65b0ea "1234"

Seems to be working ok, can you attach your code?

Regards,
Jakub Zawadzki

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
AlienVault