Open DysfunctionaI opened 2 years ago
https://github.com/spazzarama/SharpDisasm/blob/ee3af3d8aaec755208aa6782aa0eae51fd90165b/SharpDisasm/Udis86/syn.cs
Line 130:
Array.Copy(str, 0, u.asm_buf, u.asm_buf_fill, Math.Min(str.Length, avail));
Should be:
Array.Copy(str, 0, u.asm_buf, u.asm_buf_fill, Math.Min(str.Length, avail)); u.asm_buf[u.asm_buf_fill + str.Length] = '\0';
u.asm_buf[u.asm_buf_fill + str.Length] = '\0';
With the null terminator added correctly, then you don't need this bandaid:
https://github.com/spazzarama/SharpDisasm/blob/ee3af3d8aaec755208aa6782aa0eae51fd90165b/SharpDisasm/Udis86/udis86.cs
Line 103: for (var i = 0; i < u.asm_buf.Length; i++) u.asm_buf[i] = '\0';
for (var i = 0; i < u.asm_buf.Length; i++)
u.asm_buf[i] = '\0';
Can now correctly match the original as:
u.asm_buf[0] = '\0';
https://github.com/spazzarama/SharpDisasm/blob/ee3af3d8aaec755208aa6782aa0eae51fd90165b/SharpDisasm/Udis86/syn.cs
Line 130:
Array.Copy(str, 0, u.asm_buf, u.asm_buf_fill, Math.Min(str.Length, avail));
Should be:
Array.Copy(str, 0, u.asm_buf, u.asm_buf_fill, Math.Min(str.Length, avail));
u.asm_buf[u.asm_buf_fill + str.Length] = '\0';
With the null terminator added correctly, then you don't need this bandaid:
https://github.com/spazzarama/SharpDisasm/blob/ee3af3d8aaec755208aa6782aa0eae51fd90165b/SharpDisasm/Udis86/udis86.cs
Line 103:
for (var i = 0; i < u.asm_buf.Length; i++)
u.asm_buf[i] = '\0';
Can now correctly match the original as:
u.asm_buf[0] = '\0';