On Fri, Feb 19, Olaf Hering wrote:

> How does mutt decode and display base64 parts of a message?

Its Friday, so I ran it in gdb. The bug is in mutt_decode_base64. After
the base64 stream ends, a newline comes. Then the '-- ' and the
remaining msg. Initially each ch yields -1, which should trigger an exit
of the while loop. But later buf[] is filled again with the unsubscribe
text, which is seen as valid base64 and bufi gets filled further: with
garbage.

State of bufi after base64 stream ends:
(gdb) x/s bufi+274
0x7ffd74af8a22: "s,\nNorman"
(gdb) x/xg bufi+274
0x7ffd74af8a22: 0x616d726f4e0a2c73
(gdb)
0x7ffd74af8a2a: 0x7f806f6f626f006e

State of bufi after the 'Toun' went into buf[]:

(gdb) x/xg bufi + 274
0x7ffd74af8a22: 0x616d726f4e0a2c73
(gdb)
0x7ffd74af8a2a: 0x7f806f6f626f4e6e

As you can see, the 'Toun' gets converted to 0x4e, which overwrites the 0x0.


I think the loop should detect if the base64 stream was fully decoded,
then exit the loop. 

Not sure what mutt should do with the remaining text, throw it away or
showing it as is.


Olaf

Reply via email to