Perform length checking on JID parts (0 < part < 1024)

This commit is contained in:
Florian Zeitz 2012-01-25 17:20:28 +01:00
parent ee08eadf81
commit 30c1895a83

View file

@ -110,8 +110,9 @@
return; return;
} }
if ((rc = stringprep_profile([node_ UTF8String], &nodepart, if (((rc = stringprep_profile([node_ UTF8String], &nodepart,
"Nodeprep", 0)) != STRINGPREP_OK) "Nodeprep", 0)) != STRINGPREP_OK) || (nodepart[0] == '\0') ||
(strnlen(nodepart, 1024) > 1023))
@throw [XMPPStringPrepFailedException @throw [XMPPStringPrepFailedException
exceptionWithClass: isa exceptionWithClass: isa
connection: nil connection: nil
@ -138,8 +139,9 @@
char *srv; char *srv;
Stringprep_rc rc; Stringprep_rc rc;
if ((rc = stringprep_profile([domain_ UTF8String], &srv, if (((rc = stringprep_profile([domain_ UTF8String], &srv,
"Nameprep", 0)) != STRINGPREP_OK) "Nameprep", 0)) != STRINGPREP_OK) || (srv[0] == '\0') ||
(strnlen(srv, 1024) > 1023))
@throw [XMPPStringPrepFailedException @throw [XMPPStringPrepFailedException
exceptionWithClass: isa exceptionWithClass: isa
connection: nil connection: nil
@ -172,8 +174,9 @@
return; return;
} }
if ((rc = stringprep_profile([resource_ UTF8String], &res, if (((rc = stringprep_profile([resource_ UTF8String], &res,
"Resourceprep", 0)) != STRINGPREP_OK) "Resourceprep", 0)) != STRINGPREP_OK) || (res[0] == '\0') ||
(strnlen(res, 1024) > 1023))
@throw [XMPPStringPrepFailedException @throw [XMPPStringPrepFailedException
exceptionWithClass: isa exceptionWithClass: isa
connection: nil connection: nil