In browser on oled, add '<' for readonly files
fix potential out by error/buffer overflow
This commit is contained in:
parent
5fbfe85862
commit
0ddf2a6e0a
1 changed files with 13 additions and 6 deletions
|
@ -88,8 +88,8 @@ void FileBrowser::BrowsableListView::RefreshLine(u32 entryIndex, u32 x, u32 y, b
|
|||
RGBA BkColour = RGBA(0, 0, 0, 0xFF); //palette[VIC2_COLOUR_INDEX_BLUE];
|
||||
u32 columnsMax = columns;
|
||||
|
||||
if (columnsMax > sizeof(buffer1))
|
||||
columnsMax = sizeof(buffer1);
|
||||
if (columnsMax > sizeof(buffer1)-1)
|
||||
columnsMax = sizeof(buffer1)-1;
|
||||
|
||||
if (entryIndex < list->entries.size())
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ void FileBrowser::BrowsableListView::RefreshLine(u32 entryIndex, u32 x, u32 y, b
|
|||
{
|
||||
char ROstring[8] = { 0 };
|
||||
if (entry->filImage.fattrib & AM_RDO)
|
||||
strncpy (ROstring, " R", 8);
|
||||
strncpy (ROstring, "<", 8);
|
||||
if (entry->caddyIndex != -1)
|
||||
snprintf(buffer2, 256, "%d>%s%s"
|
||||
, entry->caddyIndex
|
||||
|
@ -157,7 +157,7 @@ void FileBrowser::BrowsableListView::RefreshLine(u32 entryIndex, u32 x, u32 y, b
|
|||
}
|
||||
else
|
||||
{
|
||||
memset(buffer1, ' ', 80);
|
||||
memset(buffer1, ' ', columnsMax);
|
||||
screen->PrintText(false, x, y, buffer1, BkColour, BkColour);
|
||||
}
|
||||
}
|
||||
|
@ -203,10 +203,17 @@ void FileBrowser::BrowsableListView::RefreshHighlightScroll()
|
|||
}
|
||||
else
|
||||
{
|
||||
char ROstring[8] = { 0 };
|
||||
if (entry->filImage.fattrib & AM_RDO)
|
||||
strncpy (ROstring, "<", 8);
|
||||
if (entry->caddyIndex != -1)
|
||||
snprintf(buffer2, 256, "%d>%s", entry->caddyIndex, entry->filImage.fname);
|
||||
snprintf(buffer2, 256, "%d>%s%s"
|
||||
, entry->caddyIndex
|
||||
, entry->filImage.fname
|
||||
, ROstring
|
||||
);
|
||||
else
|
||||
snprintf(buffer2, 256, "%s", entry->filImage.fname);
|
||||
snprintf(buffer2, 256, "%s%s", entry->filImage.fname, ROstring);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue