This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: IsBad*Ptr patch


"Christopher Faylor" <cgf@redhat.com> wrote:
>
> On Wed, Aug 07, 2002 at 09:50:06PM +0100, Conrad Scott wrote:
> >
> >There's nothing explicitly in there (or SUSv3, which is what
I'm
> >using) but the page only mentions *using* it if the address
> >argument is not null.  Also, the code examples in Stevens's
"Unix
> >Network Programming" for recvmsg(2) simply set the address
pointer
> >to null and leave the length pointer uninitialised, which would
> >make cygwin barf if it were also to check the address length
> >pointer.
>
> I don't have this reference.  How can a pointer be
uninitialized?
>
> Do they do something like
>
> int *len;
> recvmsg(..., NULL, len);
>
> ?
>
> That sounds like bad programming to me, but if that is the
standard
> then ok.

Sorry, I changed system call half-way through the explanation: I
agree w/ you: no-one should do what the obvious interpretation of
my comments would suggest :-)

What I meant to say was that the recvmsg(2) and sendmsg(2)
functions, which are just slightly generalised versions of the
sendto(2) and recvfrom(2) functions I was discussing, take a
msghdr struct that contains a `socklen_t *' and a `sockaddr *',
and in some of the code examples in the Stevens book, he simply
puts a NULL in the `sockaddr *' and leaves the `socklen_t *' to
fend for itself.

> Doh! Answering technical email with a splitting headache during
> meetings.  Always a sure way to embarrass myself.

Well, that makes two of us w/ headaches this afternoon.  Then
again, I was just posting out what I'd already written this
morning, so my disability wasn't so obvious.  Hope both your
headache and your meeting have passed away by now.

> I'm not 100% convinced about the len arguments but go ahead and
check
> this in and we can sort that out later.  I doubt that anyone
would ever
> complain about your changes ("Wah!  I wanted to get a ENOSYS by
passing
> a bad length argument and you wouldn't let me!") so this is
really a
> non-issue.

I suspect I know what I'd be tempted to reply if someone did try
that . . .

> Hopefully Corinna won't mind since this is technically her code
but
> I think you've more than adequately explained things.

Perhaps I ought to leave it until tomorrow in that case, to give
Corinna a chance to savour the discussion and veto the patch if
necessary.

Thanks for the feedback,

// Conrad




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]