Re: crypt and null termination

From: Doug McNaught <doug(at)wireboard(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: crypt and null termination
Date: 2001-08-17 03:17:16
Message-ID: m3k803pe83.fsf@belphigor.mcnaught.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message He Weiping 2001-08-17 03:33:12 plpgsql's variable name can't be the same with table column?
Previous Message Bruce Momjian 2001-08-17 03:09:32 Re: crypt and null termination