[misc] fix coverity warnings

This commit is contained in:
Pete Batard 2017-01-04 17:23:53 +00:00
parent d7e977e1f1
commit 5170706695
4 changed files with 24 additions and 11 deletions

View file

@ -227,8 +227,9 @@ BOOL GetOpticalMedia(IMG_SAVE* img_save)
buffer = malloc(2048);
if ((buffer != NULL) && (SetFilePointerEx(hDrive, li, NULL, FILE_BEGIN)) &&
ReadFile(hDrive, buffer, 2048, &size, NULL) && (size == 2048)) {
safe_strcpy(label, sizeof(label), (char*)&buffer[0x28]);
for (k = safe_strlen(label) - 1; (k >= 0) && (label[k] == 0x20); k--)
memcpy(label, &buffer[0x28], sizeof(label) - 1);
label[sizeof(label) - 1] = 0;
for (k = strlen(label) - 1; (k >= 0) && (label[k] == 0x20); k--)
label[k] = 0;
img_save->Label = label;
}