WriteProperty decoding length underflow (#1231)
When decoding the optional priority context tag in wp_decode_service_request(), the code passes apdu_len - apdu_size to bacnet_unsigned_context_decode instead of apdu_size - apdu_len. Similar typo in bacnet_action_command_decode().
This commit is contained in:
@@ -464,7 +464,7 @@ int bacnet_action_command_decode(
|
||||
apdu_len += len;
|
||||
/* priority [5] Unsigned (1..16) OPTIONAL */
|
||||
len = bacnet_unsigned_context_decode(
|
||||
&apdu[apdu_len], apdu_len - apdu_size, 5, &unsigned_value);
|
||||
&apdu[apdu_len], apdu_size - apdu_len, 5, &unsigned_value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
if ((unsigned_value >= BACNET_MIN_PRIORITY) &&
|
||||
@@ -483,7 +483,7 @@ int bacnet_action_command_decode(
|
||||
}
|
||||
/* postDelay [6] Unsigned OPTIONAL */
|
||||
len = bacnet_unsigned_context_decode(
|
||||
&apdu[apdu_len], apdu_len - apdu_size, 6, &unsigned_value);
|
||||
&apdu[apdu_len], apdu_size - apdu_len, 6, &unsigned_value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
if (entry) {
|
||||
@@ -497,7 +497,7 @@ int bacnet_action_command_decode(
|
||||
}
|
||||
/* quitOnFailure [7] BOOLEAN */
|
||||
len = bacnet_boolean_context_decode(
|
||||
&apdu[apdu_len], apdu_len - apdu_size, 7, &boolean_value);
|
||||
&apdu[apdu_len], apdu_size - apdu_len, 7, &boolean_value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
if (entry) {
|
||||
@@ -508,7 +508,7 @@ int bacnet_action_command_decode(
|
||||
}
|
||||
/* writeSuccessful [8] BOOLEAN */
|
||||
len = bacnet_boolean_context_decode(
|
||||
&apdu[apdu_len], apdu_len - apdu_size, 8, &boolean_value);
|
||||
&apdu[apdu_len], apdu_size - apdu_len, 8, &boolean_value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
if (entry) {
|
||||
|
||||
+1
-1
@@ -277,7 +277,7 @@ int wp_decode_service_request(
|
||||
}
|
||||
if ((unsigned)apdu_len < apdu_size) {
|
||||
len = bacnet_unsigned_context_decode(
|
||||
&apdu[apdu_len], apdu_len - apdu_size, 4, &unsigned_value);
|
||||
&apdu[apdu_len], apdu_size - apdu_len, 4, &unsigned_value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
if ((unsigned_value >= BACNET_MIN_PRIORITY) &&
|
||||
|
||||
Reference in New Issue
Block a user