Commit 831115af authored by Tyler Hicks's avatar Tyler Hicks

eCryptfs: Remove unnecessary casts when parsing packet lengths

The elements in the data array are already unsigned chars and do not
need to be casted.
Signed-off-by: default avatarTyler Hicks <tyhicks@canonical.com>
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
parent 332b122d
...@@ -100,12 +100,12 @@ int ecryptfs_parse_packet_length(unsigned char *data, size_t *size, ...@@ -100,12 +100,12 @@ int ecryptfs_parse_packet_length(unsigned char *data, size_t *size,
(*size) = 0; (*size) = 0;
if (data[0] < 192) { if (data[0] < 192) {
/* One-byte length */ /* One-byte length */
(*size) = (unsigned char)data[0]; (*size) = data[0];
(*length_size) = 1; (*length_size) = 1;
} else if (data[0] < 224) { } else if (data[0] < 224) {
/* Two-byte length */ /* Two-byte length */
(*size) = (((unsigned char)(data[0]) - 192) * 256); (*size) = (data[0] - 192) * 256;
(*size) += ((unsigned char)(data[1]) + 192); (*size) += data[1] + 192;
(*length_size) = 2; (*length_size) = 2;
} else if (data[0] == 255) { } else if (data[0] == 255) {
/* If support is added, adjust ECRYPTFS_MAX_PKT_LEN_SIZE */ /* If support is added, adjust ECRYPTFS_MAX_PKT_LEN_SIZE */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment