Skip to content

Commit

Permalink
symbol: bugfix: call CFStringGetCString when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
doronz88 committed Feb 17, 2022
1 parent d03a2f6 commit 0cac35f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/rpcclient/rpcclient/darwin/symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ def py(self):

t = self._client._cf_types[self._client.symbols.CFGetTypeID(self)]
if t == 'str':
return self._client.symbols.CFStringGetCStringPtr(self, 0).peek_str()
ptr = self._client.symbols.CFStringGetCStringPtr(self, 0)
if not ptr:
with self._client.safe_malloc(4096) as buf:
if not self._client.symbols.CFStringGetCString(self, buf, 4096, 0):
raise CfSerializationError('CFStringGetCString failed')
return buf.peek_str()
return ptr.peek_str()
if t == 'bool':
return bool(self._client.symbols.CFBooleanGetValue(self, 0))
if t == 'number':
Expand Down

0 comments on commit 0cac35f

Please sign in to comment.