Out of range exception in strcpy_VBsafe(out string sout, string sin)
Closed this issue · 1 comments
sebsebien commented
Length of the input string must be tested in strcpy_VBsafe(out string sout, string sin). Here's an example of fix that works well for me:
void strcpy_VBsafe(out string sout, string sin) {
while (i < sin.Length && i < 30 && (Char.IsLetterOrDigit(sin[i]) || sin[i] == ' ' || sin[i] == '-'))
i++;
sout = sin.Substring(0, i);
}