mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-23 13:41:31 +00:00
Trim null byte from LoginData username
This commit is contained in:
parent
b18612642b
commit
7a7c68fc91
2 changed files with 3 additions and 4 deletions
|
@ -12,7 +12,6 @@ namespace ProjectLighthouse.Controllers {
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/login")]
|
[Route("LITTLEBIGPLANETPS3_XML/login")]
|
||||||
[Produces("text/xml")]
|
[Produces("text/xml")]
|
||||||
public class LoginController : ControllerBase {
|
public class LoginController : ControllerBase {
|
||||||
[HttpGet]
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IActionResult> Login() {
|
public async Task<IActionResult> Login() {
|
||||||
if(!this.Request.Query.TryGetValue("titleID", out StringValues _))
|
if(!this.Request.Query.TryGetValue("titleID", out StringValues _))
|
||||||
|
|
|
@ -21,9 +21,9 @@ namespace ProjectLighthouse.Types {
|
||||||
|
|
||||||
public static LoginData CreateFromString(string str) {
|
public static LoginData CreateFromString(string str) {
|
||||||
do {
|
do {
|
||||||
str = str.Replace("\b", "");
|
str = str.Replace("\b", string.Empty); // Trim backspace characters
|
||||||
} while(str.Contains('\b'));
|
} while(str.Contains('\b'));
|
||||||
|
|
||||||
using MemoryStream ms = new(Encoding.ASCII.GetBytes(str));
|
using MemoryStream ms = new(Encoding.ASCII.GetBytes(str));
|
||||||
using BinaryReader reader = new(ms);
|
using BinaryReader reader = new(ms);
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ namespace ProjectLighthouse.Types {
|
||||||
// byte[] endBytes = reader.ReadBytes((int)(ms.Length - reader.BaseStream.Position));
|
// byte[] endBytes = reader.ReadBytes((int)(ms.Length - reader.BaseStream.Position));
|
||||||
// string end = Encoding.ASCII.GetString(endBytes);
|
// string end = Encoding.ASCII.GetString(endBytes);
|
||||||
|
|
||||||
loginData.Username = BinaryHelper.ReadString(reader);
|
loginData.Username = BinaryHelper.ReadString(reader).Replace("\0", string.Empty);
|
||||||
|
|
||||||
return loginData;
|
return loginData;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue