Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: exim: dev

null char in string expansions

 

 

exim dev RSS feed   Index | Next | Previous | View Threaded


exim-dev at lists

Nov 5, 2009, 10:57 AM

Post #1 of 2 (114 views)
Permalink
null char in string expansions

Hi,

I was trying to generate unique IDs by taking a bunch of variables,
joining them together and creating an MD5 of the result. I used the null
character to separate the items before generating the MD5 which lead to
me accidently coming across this problem:

root[at]haven:~# exim4 -be '${md5:foo}'
acbd18db4cc2f85cedef654fccc4a4d8
root[at]haven:~# exim4 -be '${md5:foo\0bar}'
acbd18db4cc2f85cedef654fccc4a4d8
root[at]haven:~#

I'm assuming that's a bug? It doesn't just affect ${md5} ...

root[at]haven:~# exim4 -be '${substr_0_6:foo\0bar}'
foo
root[at]haven:~#

Should I bugzilla it?

--
Mike Cardwell - IT Consultant and LAMP developer
Cardwell IT Ltd. (UK Reg'd Company #06920226) http://cardwellit.com/
Technical Blog: https://secure.grepular.com/blog/

--
## List details at http://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##


exim-dev at spodhuis

Nov 5, 2009, 6:15 PM

Post #2 of 2 (103 views)
Permalink
Re: null char in string expansions [In reply to]

On 2009-11-05 at 18:57 +0000, Mike Cardwell wrote:
> Hi,
>
> I was trying to generate unique IDs by taking a bunch of variables,
> joining them together and creating an MD5 of the result. I used the null
> character to separate the items before generating the MD5 which lead to
> me accidently coming across this problem:
>
> root[at]haven:~# exim4 -be '${md5:foo}'
> acbd18db4cc2f85cedef654fccc4a4d8
> root[at]haven:~# exim4 -be '${md5:foo\0bar}'
> acbd18db4cc2f85cedef654fccc4a4d8
> root[at]haven:~#
>
> I'm assuming that's a bug? It doesn't just affect ${md5} ...
>
> root[at]haven:~# exim4 -be '${substr_0_6:foo\0bar}'
> foo
> root[at]haven:~#
>
> Should I bugzilla it?

Exim's string handling language is not NUL-safe and it's a design choice
-- C strings are used everywhere. PH explained this to me when I wanted
to use a NUL separator between fields stored as values in CDB files,
IIRC.

You can file a bug, sure, but the amount of work involved in changing
this would be considerable. Exim handles NULs in emails just fine, but
not in any of the current string handling code.

-Phil

--
## List details at http://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##

exim dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.