discovered the use of strndup()

This commit is contained in:
Andreas Steffen
2012-11-15 11:48:57 +01:00
parent a95959cce6
commit bacffb890e
7 changed files with 8 additions and 28 deletions
+1 -3
View File
@@ -96,9 +96,7 @@ METHOD(pa_tnc_attr_t, build, void,
METHOD(pa_tnc_attr_t, process, status_t,
private_ita_attr_command_t *this, u_int32_t *offset)
{
this->command = malloc(this->value.len + 1);
memcpy(this->command, this->value.ptr, this->value.len);
this->command[this->value.len] = '\0';
this->command = strndup(this->value.ptr, this->value.len);
return SUCCESS;
}