command: Add command_decode_ptr() helper
Add a helper function to convert from a string buffer passed in the args[] parameter to an actual pointer. This avoids all the callers needing to perfrom pointer manipulation. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
1 parent
aaf3dc6ac3
commit
473828ca6a
10 files changed
+38
-30
No files matched your search
+1
-1
@@ -195,7 +195,7 @@ command_tmcuart_send(uint32_t *args)
|
||||
// Uart is busy - silently drop this request (host should retransmit)
|
||||
return;
|
||||
uint8_t write_len = args[1];
|
||||
uint8_t *write = (void*)(size_t)args[2];
|
||||
uint8_t *write = command_decode_ptr(args[2]);
|
||||
uint8_t read_len = args[3];
|
||||
if (write_len > sizeof(t->data) || read_len > sizeof(t->data))
|
||||
shutdown("tmcuart data too large");
|
||||
|
||||
Reference in new issue
Block a user