scst_pres: Avoid reading past the end of a buffer

Detected by smatch.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7915 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2019-02-11 00:09:33 +00:00
parent e730c8cd58
commit 77d9c561d5
+2 -2
View File
@@ -762,7 +762,7 @@ static int scst_pr_do_load_device_file(struct scst_device *dev,
}
pos += sizeof(version);
while (data_size < file_size) {
while (data_size + 1 < file_size) {
uint8_t *tid;
data_size++;
@@ -794,7 +794,7 @@ static int scst_pr_do_load_device_file(struct scst_device *dev,
dev->pr_scope = buf[pos];
pos += sizeof(dev->pr_scope);
while (pos < file_size) {
while (pos + 1 < file_size) {
uint8_t is_holder;
uint8_t *tid;
struct scst_dev_registrant *reg = NULL;