From 762170350fb4f49a8942c562e93bfa37709d5c67 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 11 Feb 2007 11:56:33 +0000 Subject: [PATCH] Coverity - fix IPv6 addr parsing --- servers/slapd/sasl.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/servers/slapd/sasl.c b/servers/slapd/sasl.c index 0cd5afca9a..9a81f4e85f 100644 --- a/servers/slapd/sasl.c +++ b/servers/slapd/sasl.c @@ -1053,16 +1053,16 @@ static char * slap_sasl_peer2ipport( struct berval *peer ) { int isv6 = 0; - char *ipport, - *p = &peer->bv_val[ STRLENOF( "IP=" ) ]; + char *ipport, *p, + *addr = &peer->bv_val[ STRLENOF( "IP=" ) ]; ber_len_t plen = peer->bv_len - STRLENOF( "IP=" ); /* IPv6? */ - if ( p[0] == '[' ) { + if ( addr[0] == '[' ) { isv6 = 1; plen--; } - ipport = ch_strdup( &p[isv6] ); + ipport = ch_strdup( &addr[isv6] ); /* Convert IPv6/IPv4 addresses to address;port syntax. */ p = strrchr( ipport, ':' ); @@ -1076,8 +1076,8 @@ slap_sasl_peer2ipport( struct berval *peer ) } else if ( isv6 ) { /* trim ']' */ plen--; - assert( p[plen] == ']' ); - p[plen] = '\0'; + assert( addr[plen] == ']' ); + addr[plen] = '\0'; } return ipport; -- 2.39.5