Skip to content

Commit

Permalink
Ensure that string type records are null terminated
Browse files Browse the repository at this point in the history
This also ensures that writing more than 39 characters to a string record
will fail with a "string too long" error.
  • Loading branch information
Araneidae committed Feb 3, 2022
1 parent 32929bd commit 53f107d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion softioc/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def _value_to_epics(self, value):
# Value being written must be a string, and will be automatically null
# terminated where possible.
result = self._ctype_()
result.value = value.encode()
result.value = value.encode() + b'\0'
return result

def _epics_to_value(self, epics):
Expand Down

0 comments on commit 53f107d

Please sign in to comment.