Mercurial > hg > freeDiameter
changeset 719:dc71992e3378
Be less tolerant on DiameterURI format
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Mon, 21 Feb 2011 18:29:14 +0900 |
parents | 2d5e76dd1117 |
children | 2c7c423eaba9 |
files | libfdproto/ostr.c |
diffstat | 1 files changed, 8 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/libfdproto/ostr.c Fri Feb 18 15:23:09 2011 +0900 +++ b/libfdproto/ostr.c Mon Feb 21 18:29:14 2011 +0900 @@ -315,9 +315,8 @@ t += p * 10; /* the port is specified in decimal base */ if (t >= (1<<16)) { - TRACE_DEBUG(INFO, "Invalid DiameterURI: port value is too big, ignored."); - p = 0; - break; + TRACE_DEBUG(INFO, "Invalid DiameterURI: port value is too big."); + return EINVAL; } p = t; @@ -365,10 +364,8 @@ goto after_transport; } - TRACE_DEBUG(INFO, "Invalid DiameterURI: transport string is not recognized ('%.*s'), ignored.", urisz - offset, uri + offset); - - /* eat the remaining of invalid transport until a ';' */ - for (; (offset < urisz) && ((char)uri[offset] != ';'); offset++); + TRACE_DEBUG(INFO, "Invalid DiameterURI: transport string is not recognized ('%.*s').", urisz - offset, uri + offset); + return EINVAL; } after_transport: if (offset == urisz) @@ -404,17 +401,16 @@ goto after_proto; } - TRACE_DEBUG(INFO, "Invalid DiameterURI: protocol string is not recognized ('%.*s'), ignored.", urisz - offset, uri + offset); + TRACE_DEBUG(INFO, "Invalid DiameterURI: protocol string is not recognized ('%.*s').", urisz - offset, uri + offset); + return EINVAL; - /* eat the remaining of invalid transport until a ';' */ - for (; (offset < urisz) && ((char)uri[offset] != ';'); offset++); } after_proto: if (offset == urisz) return 0; /* Finished */ - TRACE_DEBUG(INFO, "Invalid DiameterURI: string is not recognized ('%.*s'), ignored.", urisz - offset, uri + offset); - return 0; + TRACE_DEBUG(INFO, "Invalid DiameterURI: final part of string is not recognized ('%.*s').", urisz - offset, uri + offset); + return EINVAL; }