Skip to content

Commit a66ae1d

Browse files
committed
Fix 'ascii' not support 128~255 problem
1 parent 296cb75 commit a66ae1d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

qiling/os/uefi/bs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from binascii import crc32
77

8+
from qiling.const import QL_ENDIAN
89
from qiling.os.const import *
910
from qiling.os.uefi.const import *
1011
from qiling.os.uefi.fncc import dxeapi
@@ -497,7 +498,8 @@ def hook_SetMem(ql: Qiling, address: int, params):
497498
value: int = params["Value"] & 0xff
498499
size = params["Size"]
499500

500-
ql.mem.write(buffer, bytes(chr(value), 'ascii') * size)
501+
byteorder = 'little' if ql.archendian == QL_ENDIAN.EL else 'big'
502+
ql.mem.write(buffer, value.to_bytes(1, byteorder=byteorder) * size)
501503

502504
@dxeapi(params = {
503505
"Type" : UINT, # UINT32

0 commit comments

Comments
 (0)