sasl.c (98121) | sasl.c (98841) |
---|---|
1/* 2 * Copyright (c) 2001-2002 Sendmail, Inc. and its suppliers. 3 * All rights reserved. 4 * 5 * By using this file, you agree to the terms and conditions set 6 * forth in the LICENSE file which can be found at the top level of 7 * the sendmail distribution. 8 * 9 */ 10 11#include <sm/gen.h> | 1/* 2 * Copyright (c) 2001-2002 Sendmail, Inc. and its suppliers. 3 * All rights reserved. 4 * 5 * By using this file, you agree to the terms and conditions set 6 * forth in the LICENSE file which can be found at the top level of 7 * the sendmail distribution. 8 * 9 */ 10 11#include <sm/gen.h> |
12SM_RCSID("@(#)$Id: sasl.c,v 8.18 2002/05/25 00:26:42 gshapiro Exp $") | 12SM_RCSID("@(#)$Id: sasl.c,v 8.19 2002/06/12 15:06:12 ca Exp $") |
13 14#if SASL 15# include <stdlib.h> 16# include <sendmail.h> 17# include <errno.h> 18 19/* 20** In order to ensure that storage leaks are tracked, and to prevent --- 236 unchanged lines hidden (view full) --- 257 NI_NUMERICHOST | NI_WITHSCOPEID | NI_NUMERICSERV) != 0) 258 return false; 259# else /* NETINET6 */ 260 if (addr->sa.sa_family != AF_INET) 261 { 262 errno = EINVAL; 263 return false; 264 } | 13 14#if SASL 15# include <stdlib.h> 16# include <sendmail.h> 17# include <errno.h> 18 19/* 20** In order to ensure that storage leaks are tracked, and to prevent --- 236 unchanged lines hidden (view full) --- 257 NI_NUMERICHOST | NI_WITHSCOPEID | NI_NUMERICSERV) != 0) 258 return false; 259# else /* NETINET6 */ 260 if (addr->sa.sa_family != AF_INET) 261 { 262 errno = EINVAL; 263 return false; 264 } |
265 if (inet_ntop(AF_INET, &(addr->sin.sin_addr), 266 hbuf, sizeof hbuf) == NULL) | 265 if (sm_strlcpy(hbuf, inet_ntoa(addr->sin.sin_addr), sizeof(hbuf)) 266 >= sizeof(hbuf)) |
267 { | 267 { |
268 errno = EINVAL; | 268 errno = ENOMEM; |
269 return false; 270 } 271 sm_snprintf(pbuf, sizeof pbuf, "%d", ntohs(addr->sin.sin_port)); 272# endif /* NETINET6 */ 273 274 if (outlen < strlen(hbuf) + strlen(pbuf) + 2) 275 { 276 errno = ENOMEM; 277 return false; 278 } 279 sm_snprintf(out, outlen, "%s;%s", hbuf, pbuf); 280 return true; 281} 282# endif /* SASL >= 20000 */ 283#endif /* SASL */ | 269 return false; 270 } 271 sm_snprintf(pbuf, sizeof pbuf, "%d", ntohs(addr->sin.sin_port)); 272# endif /* NETINET6 */ 273 274 if (outlen < strlen(hbuf) + strlen(pbuf) + 2) 275 { 276 errno = ENOMEM; 277 return false; 278 } 279 sm_snprintf(out, outlen, "%s;%s", hbuf, pbuf); 280 return true; 281} 282# endif /* SASL >= 20000 */ 283#endif /* SASL */ |