Code Review
/
ric-plt
/
lib
/
rmr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Correct excessive TCP connection bug
[ric-plt/lib/rmr.git]
/
src
/
rmr
/
si
/
src
/
si95
/
siaddress.c
diff --git
a/src/rmr/si/src/si95/siaddress.c
b/src/rmr/si/src/si95/siaddress.c
index
7cec5dd
..
153e6ac
100644
(file)
--- a/
src/rmr/si/src/si95/siaddress.c
+++ b/
src/rmr/si/src/si95/siaddress.c
@@
-148,6
+148,10
@@
extern int SIaddress( void *src, void **dest, int type ) {
int i;
int rlen = 0; // return len - len of address struct or string
int i;
int rlen = 0; // return len - len of address struct or string
+ if( src == NULL || dest == NULL ) {
+ return rlen;
+ }
+
switch( type ) {
case AC_TODOT: // convert from a struct to human readable "dotted decimal"
addr = (struct sockaddr_in *) src;
switch( type ) {
case AC_TODOT: // convert from a struct to human readable "dotted decimal"
addr = (struct sockaddr_in *) src;
@@
-155,7
+159,7
@@
extern int SIaddress( void *src, void **dest, int type ) {
if( addr->sin_family == AF_INET6 ) {
addr6 = (struct sockaddr_in6 *) src; // really an ip6 struct
byte = (uint8_t *) &addr6->sin6_addr;
if( addr->sin_family == AF_INET6 ) {
addr6 = (struct sockaddr_in6 *) src; // really an ip6 struct
byte = (uint8_t *) &addr6->sin6_addr;
- snprintf( wbuf, sizeof( wbuf ), "[%u:%u:%u:%u:%u:%u]:%d",
+
snprintf( wbuf, sizeof( wbuf ), "[%u:%u:%u:%u:%u:%u]:%d",
*(byte+0), *(byte+1), *(byte+2),
*(byte+3), *(byte+4), *(byte+5) ,
(int) ntohs( addr6->sin6_port ) );
*(byte+0), *(byte+1), *(byte+2),
*(byte+3), *(byte+4), *(byte+5) ,
(int) ntohs( addr6->sin6_port ) );