diff options
Diffstat (limited to 'src/libimcv/ita/ita_attr_command.c')
-rw-r--r-- | src/libimcv/ita/ita_attr_command.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/libimcv/ita/ita_attr_command.c b/src/libimcv/ita/ita_attr_command.c index 08a9efa02..679f2c3f4 100644 --- a/src/libimcv/ita/ita_attr_command.c +++ b/src/libimcv/ita/ita_attr_command.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2012 Andreas Steffen + * Copyright (C) 2011-2014 Andreas Steffen * HSR Hochschule fuer Technik Rapperswil * * This program is free software; you can redistribute it and/or modify it @@ -40,7 +40,12 @@ struct private_ita_attr_command_t { pen_type_t type; /** - * Attribute value + * Length of attribute value + */ + size_t length; + + /** + * Attribute value or segment */ chunk_t value; @@ -92,11 +97,18 @@ METHOD(pa_tnc_attr_t, build, void, return; } this->value = chunk_clone(chunk_from_str(this->command)); + this->length = this->value.len; } METHOD(pa_tnc_attr_t, process, status_t, private_ita_attr_command_t *this, u_int32_t *offset) { + *offset = 0; + + if (this->value.len < this->length) + { + return NEED_MORE; + } this->command = strndup(this->value.ptr, this->value.len); return SUCCESS; @@ -158,7 +170,7 @@ pa_tnc_attr_t *ita_attr_command_create(char *command) /** * Described in header. */ -pa_tnc_attr_t *ita_attr_command_create_from_data(chunk_t data) +pa_tnc_attr_t *ita_attr_command_create_from_data(size_t length, chunk_t data) { private_ita_attr_command_t *this; @@ -177,6 +189,7 @@ pa_tnc_attr_t *ita_attr_command_create_from_data(chunk_t data) .get_command = _get_command, }, .type = {PEN_ITA, ITA_ATTR_COMMAND }, + .length = length, .value = chunk_clone(data), .ref = 1, ); |