1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-03-24 18:16:24 +01:00

Return an empty stat buf when stat fails

This commit is contained in:
Spencer McIntyre 2021-12-08 10:19:11 -05:00
parent 286c93b9ff
commit 7bbcee3cf7

@ -1494,7 +1494,11 @@ def stdapi_fs_ls(request, response):
file_path = os.path.join(path, file_name)
response += tlv_pack(TLV_TYPE_FILE_NAME, file_name)
response += tlv_pack(TLV_TYPE_FILE_PATH, file_path)
response += tlv_pack(TLV_TYPE_STAT_BUF, get_stat_buffer(file_path))
try:
st_buf = get_stat_buffer(file_path)
except OSError:
st_buf = bytes()
response += tlv_pack(TLV_TYPE_STAT_BUF, st_buf)
return ERROR_SUCCESS, response
@register_function