[krbdev.mit.edu #1185] krb524/sendmsg.c may be rejected by picky compilers

The RT System itself via RT rt-comment at krbdev.mit.edu
Sat Sep 14 15:36:58 EDT 2002


>From dsr at mail.lns.cornell.edu  Sat Sep 14 15:36:55 2002
Received: from fort-point-station.mit.edu (FORT-POINT-STATION.MIT.EDU [18.7.7.76]) by krbdev.mit.edu (8.9.3) with ESMTP
	id PAA08459; Sat, 14 Sep 2002 15:36:55 -0400 (EDT)
Received: from lnscu5.lns.cornell.edu (lnscu5.lns.cornell.edu [128.84.44.111])
	by fort-point-station.mit.edu (8.9.2/8.9.2) with ESMTP id PAA19076
	for <krb5-bugs at mit.edu>; Sat, 14 Sep 2002 15:36:55 -0400 (EDT)
Received: from nile02.lns.cornell.edu (nile02.lns.cornell.edu [128.84.46.186])
	by lnscu5.lns.cornell.edu (8.12.2/8.12.2) with ESMTP id g8EJascp023372
	for <krb5-bugs at mit.edu>; Sat, 14 Sep 2002 15:36:54 -0400 (EDT)
From: Dan Riley <dsr at mail.lns.cornell.edu>
Received: by nile02.lns.cornell.edu (8.8.8/1.1.10.5/23Nov96-0144PM)
	id PAA0000029434; Sat, 14 Sep 2002 15:36:53 -0400 (EDT)
Date: Sat, 14 Sep 2002 15:36:53 -0400 (EDT)
Message-Id: <200209141936.PAA0000029434 at nile02.lns.cornell.edu>
To: krb5-bugs at mit.edu
Subject: krb524/sendmsg.c does not compile on Tru64 with 'cc -std1'
Reply-To: dsr at mail.lns.cornell.edu
X-send-pr-version: 3.99


>Submitter-Id:	net
>Originator:	Dan Riley
>Organization:	LEPP, Cornell University
>Confidential:	no
>Synopsis:	krb524/sendmsg.c may be rejected by picky compilers
>Severity:	non-critical
>Priority:	medium
>Category:	krb5-build
>Class:		sw-bug
>Release:	krb5-1.2.6
>Environment:
System: OSF1 nile02.lns.cornell.edu V4.0 1229 alpha
Machine: alpha
>Description:
Tru64 'cc -std1' rejects krb524/sendmsg.c due to a minor but in the
source
>How-To-Repeat:
Compile krb5 1.2.6 on Tru64 with 'cc -std1'; it will refuse to
compile this line in sendmsg.c:

	if ((local_addr != NULL) && (addrlen != NULL) && (addrlen > 0)) {

with the (correct) complaint that the result of comparing a pointer
(addrlen) to be greater than 0 is undefined.
>Fix:
I'd guess that the intent was to check that the value pointed to by
addrlen is > 0:

--- krb5-1.2.6/src/krb524/sendmsg.c	Tue May 28 11:18:52 2002
+++ krb5/src/krb524/sendmsg.c	Sat Sep 14 14:32:33 2002
@@ -227,7 +227,7 @@
 
 		/* If the caller wants the local address of this socket
 		   store it here */
-		if ((local_addr != NULL) && (addrlen != NULL) && (addrlen > 0)) {
+		if ((local_addr != NULL) && (addrlen != NULL) && (*addrlen > 0)) {
 		    if (getsockname (socklist[host], local_addr, addrlen) == SOCKET_ERROR) {
 		        /* no address to get... tell the caller we got nothing */
 		        *addrlen = 0;



More information about the krb5-bugs mailing list