Skip to content

Commit

Permalink
Corrected an overread in m04.luabnd.dcx
Browse files Browse the repository at this point in the history
  • Loading branch information
Wulf2k committed Jun 30, 2023
1 parent 170d74b commit 9e343bf
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions DeS-BNDBuild/DeS_BNDBuild.vb
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ Public Class Des_BNDBuild
Return UnicodeEncoding.GetString(b.ToArray())
End Function

Private Function RAsciiStr(ByVal loc As UInteger) As String
Private Function RAsciiStr(ByVal loc As UInteger, Optional ByVal num As UInteger = UInteger.MaxValue) As String
Dim Str As String = ""
Dim cont As Boolean = True

While cont
While (cont And (loc < bytes.Length - 1) And (loc < num))
If bytes(loc) > 0 Then
Str = Str + Convert.ToChar(bytes(loc))
loc += 1
Expand Down Expand Up @@ -580,7 +580,7 @@ Public Class Des_BNDBuild
Dim OnlyDCX = False


Select Case Microsoft.VisualBasic.Left(RAsciiStr(0), 4)
Select Case RAsciiStr(0, 4)
Case "BHD5"

'DS3 BHD5 Reversing by Atvaark
Expand Down Expand Up @@ -646,7 +646,7 @@ Public Class Des_BNDBuild

BinderID = ""
If IsDS3 Then
BinderID = RAsciiStrNumBytes(&H1C, RUInt32(&H18))
BinderID = RAsciiStr(&H1C, RUInt32(&H18))
Else
For k = 0 To &HF
Dim tmpchr As Char
Expand Down Expand Up @@ -718,9 +718,9 @@ Public Class Des_BNDBuild

Dim ms As New MemoryStream()
Dim aes As New AesManaged() With {
.Mode = CipherMode.ECB,
.Padding = PaddingMode.None
}
.Mode = CipherMode.ECB,
.Padding = PaddingMode.None
}

Dim cs As New CryptoStream(ms, aes.CreateDecryptor(aesKey, iv), CryptoStreamMode.Write)

Expand Down Expand Up @@ -755,9 +755,9 @@ Public Class Des_BNDBuild

Dim ms As New MemoryStream()
Dim aes As New AesManaged() With {
.Mode = CipherMode.ECB,
.Padding = PaddingMode.None
}
.Mode = CipherMode.ECB,
.Padding = PaddingMode.None
}

Dim cs As New CryptoStream(ms, aes.CreateDecryptor(aesKey, iv), CryptoStreamMode.Write)

Expand Down Expand Up @@ -1416,7 +1416,7 @@ Public Class Des_BNDBuild


Catch ex As Exception
MessageBox.Show(ex.Message)
'MessageBox.Show(ex.Message)
'MessageBox.Show("Stack Trace: " & vbCrLf & ex.StackTrace)
output(TimeOfDay & " - Unhandled exception - " & ex.Message & ex.StackTrace & Environment.NewLine)
End Try
Expand Down

0 comments on commit 9e343bf

Please sign in to comment.