[Hostname-devel] Off-by-one bug?

Michael Meskes meskes at debian.org
Thu Jun 22 16:33:59 UTC 2017


Geoff,

> I took a look at the source code for hostname for another purpose,
> but I
> see that there appears to be an off-by-one bug in check_name().  The
> loop will be looking at name[-1] on the first iteration.
> 
> Can someone confirm?

No, I do not see how this could happen. It would have been nice to
include a version number and maybe even the code in question, but I
assume you're looking at the latest version.

As for the position where it could happen I can only guess. My guess
would be the name [i-1] in one of the if clauses. However, these are
not executed for i=0 because they're covered by name[i] == '-' or name
[i] == '.' in the same line and the !isalnum(name[0]) in the line above
the for clause.

Or did I miss something?

Michael
-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael at xmpp dot meskes dot org
VfL Borussia! Força Barça! SF 49ers! Use Debian GNU/Linux, PostgreSQL



More information about the Hostname-devel mailing list