Skip to content

Added check for null terminated string in title#12

Open
nexus4880 wants to merge 3 commits intoBotRandomness:imguifrom
nexus4880:null-terminated-rom-titles
Open

Added check for null terminated string in title#12
nexus4880 wants to merge 3 commits intoBotRandomness:imguifrom
nexus4880:null-terminated-rom-titles

Conversation

@nexus4880
Copy link

This PR addresses #10

byte[] titleBytes = new byte[16];
Array.Copy(rom, 0x0134, titleBytes, 0, 16);

string title = System.Text.Encoding.ASCII.GetString(titleBytes).TrimEnd(null);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.TrimEnd('\0')

should also solve this issue

break;
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this if needed if the Array is 16 long?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants