Skip to content

Commit

Permalink
Fix typo in alloc_and_write_wstring calling non-existent method
Browse files Browse the repository at this point in the history
`str_to_uniz_a` does not exist, updated to `str_to_uni_z`. Looking at cross-references, only two modules use this method to convert from ruby strings to null-terminated WCHARs. Updated the comments to clarify usage of this method and fixed the typo.
  • Loading branch information
upsidedwn authored Jan 26, 2024
1 parent 7a7c7eb commit 9391e11
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,12 @@ def read_wstring(pointer, length = nil)
#
# Write Unicode strings to memory.
#
# Given a Unicode string, returns a pointer to a null terminated WCHARs array.
# InitializeUnicodeStr(&uStr, sL"string");
# Given a string, returns a pointer to a null terminated WCHARs array.
#
def alloc_and_write_wstring(value)
return nil if value.nil?

alloc_and_write_data(str_to_uniz_a(value))
alloc_and_write_data(str_to_uni_z(value))
end

alias free_wstring free_data
Expand Down

0 comments on commit 9391e11

Please sign in to comment.