Re: crypt and null termination - Mailing list pgsql-hackers

From Doug McNaught
Subject Re: crypt and null termination
Date
Msg-id m3k803pe83.fsf@belphigor.mcnaught.org
Whole thread Raw
In response to crypt and null termination  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:

> > > and conn.salt is char[2].  Isn't this a problem?
> > 
> > I don't think it is.  Note that it refers to the salt as a "character
> > array", not a string.  Also, since '_' isn't in the allowed encoding
> > set, it can tell the difference between a 9-byte salt and a 2-byte
> > salt without a terminating NUL.
> 
> I didn't pick up that array item.
> 
> Anyway, the patch is small so I will apply it.  There is no telling what
> OS's expect a character string there.

Certainly won't hurt.  I just looked at the docs for glibc on Linux,
and it has its own semi-weird extension format for MD5-based hashing,
but doesn't seem to require null termination--it uses an initial '$',
which again isn't part of the encoding set, as a discriminator rather
than '_', and will treat either another '$' or a NUL as the terminator 
for the extended salt.

-Doug
-- 
Free Dmitry Sklyarov! 
http://www.freesklyarov.org/ 

We will return to our regularly scheduled signature shortly.


pgsql-hackers by date:

Previous
From: He Weiping
Date:
Subject: plpgsql's variable name can't be the same with table column?
Next
From: Bruce Momjian
Date:
Subject: Re: crypt and null termination