diff --git a/generator/C/include_v0.9/protocol.h b/generator/C/include_v0.9/protocol.h index d230ed102..0634f25d7 100644 --- a/generator/C/include_v0.9/protocol.h +++ b/generator/C/include_v0.9/protocol.h @@ -197,8 +197,11 @@ static inline void mav_array_assign_char(char *dest, const char *src, size_t n) */ static inline void _mav_put_char_array(char *buf, uint8_t wire_offset, const char *b, uint8_t array_length) { - mav_array_memcpy(&buf[wire_offset], b, array_length); - + if (b == NULL) { + memset(&buf[wire_offset], 0, array_length); + } else { + strncpy(&buf[wire_offset], b, array_length); + } } /* diff --git a/generator/C/include_v1.0/protocol.h b/generator/C/include_v1.0/protocol.h index 06f895736..99a1d5b6c 100644 --- a/generator/C/include_v1.0/protocol.h +++ b/generator/C/include_v1.0/protocol.h @@ -213,8 +213,11 @@ static inline void mav_array_assign_char(char *dest, const char *src, size_t n) */ static inline void _mav_put_char_array(char *buf, uint8_t wire_offset, const char *b, uint8_t array_length) { - mav_array_memcpy(&buf[wire_offset], b, array_length); - + if (b == NULL) { + memset(&buf[wire_offset], 0, array_length); + } else { + strncpy(&buf[wire_offset], b, array_length); + } } /*