Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 19 Feb 2019 13:09:21 -0800
From: Michael Forney <>
Subject: Re: Error in getaddrinfo()?

On 2019-02-19, Markus Wichmann <> wrote:
> And while we're on the subject, a few lines later we get
> 			.ai_next = &out[k+1].ai };
> Now, for the last k, isn't this calculation undefined? The array index
> is out of bounds, then. It won't matter what is calculated here, since
> the last .ai_next is explicitly nulled a few lines further down, but the
> calculation might invoke undefined behavior, and these last few years
> compilers have gotten really agressive about that.

I don't think it is undefined behavior, as long as it is not
dereferenced. See

"If both the pointer operand and the result point to elements of the
same array object, or one past the last element of the array object,
the evaluation shall not produce an overflow; otherwise, the behavior
is undefined. If the result points one past the last element of the
array object, it shall not be used as the operand of a unary *
operator that is evaluated."

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.