corrected possible overflow in dlmstp.c for PIC and RTOS-32. Thank you Martin!

This commit is contained in:
skarg
2009-03-06 11:04:51 +00:00
parent f9d6bd8ed2
commit 75bd715bd4
3 changed files with 3 additions and 3 deletions
Binary file not shown.
+1 -1
View File
@@ -112,7 +112,7 @@ int dlmstp_send_pdu(
return -2; return -2;
} }
dlmstp_get_my_address(&src); dlmstp_get_my_address(&src);
if ((8 /* header len */ + pdu_len) > MAX_MPDU) { if ((MAX_HEADER + pdu_len) > MAX_MPDU) {
return -4; return -4;
} }
bytes_sent = bytes_sent =
+2 -2
View File
@@ -89,8 +89,8 @@ int dlmstp_send_pdu(
return -2; return -2;
} }
/* header len */ /* header len */
mtu_len = 8; mtu_len = MAX_HEADER - 2 /* data crc */;
if ((mtu_len + pdu_len) > MAX_MPDU) { if ((MAX_HEADER + pdu_len) > MAX_MPDU) {
#if PRINT_ENABLED #if PRINT_ENABLED
fprintf(stderr, "mstp: PDU is too big to send!\n"); fprintf(stderr, "mstp: PDU is too big to send!\n");
#endif #endif