More utf-8 validation.

pull/793/head
Roger A. Light 8 years ago
parent 7bf16919f3
commit 574fb36ede

@ -129,6 +129,9 @@ int mosquitto_reinitialise(struct mosquitto *mosq, const char *id, bool clean_se
if(STREMPTY(id)){
return MOSQ_ERR_INVAL;
}
if(mosquitto_validate_utf8(id, strlen(id))){
return MOSQ_ERR_MALFORMED_UTF8;
}
mosq->id = mosquitto__strdup(id);
}else{
mosq->id = (char *)mosquitto__calloc(24, sizeof(char));

@ -54,6 +54,9 @@ int mosquitto_username_pw_set(struct mosquitto *mosq, const char *username, cons
mosq->password = NULL;
if(username){
if(mosquitto_validate_utf8(username, strlen(username))){
return MOSQ_ERR_MALFORMED_UTF8;
}
mosq->username = mosquitto__strdup(username);
if(!mosq->username) return MOSQ_ERR_NOMEM;
if(password){

Loading…
Cancel
Save