Fix crash due to negative max copy length.

This commit is contained in:
Jan Vidar Krey 2014-09-23 00:01:15 +02:00
parent f71bc59527
commit 1da917e5b9

View File

@ -390,7 +390,7 @@ static int check_user_agent(struct hub_info* hub, struct hub_user* user, struct
str = adc_msg_unescape(ua_version_encoded); str = adc_msg_unescape(ua_version_encoded);
if (str) if (str)
{ {
memcpy(user->id.user_agent + offset, str, MIN(strlen(str), MAX_UA_LEN) - offset); memcpy(user->id.user_agent + offset, str, MIN(strlen(str), MAX_UA_LEN - offset));
hub_free(str); hub_free(str);
} }
} }