mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 04:30:24 +01:00
Use memcpy instead of strncpy; add usart.status to stm.
This commit is contained in:
@@ -200,7 +200,7 @@ mp_obj_t str_strip(int n_args, const mp_obj_t *args) {
|
||||
size_t stripped_len = last_good_char_pos - first_good_char_pos + 1;
|
||||
//+1 to accomodate '\0'
|
||||
char *stripped_str = m_new(char, stripped_len + 1);
|
||||
strncpy(stripped_str, orig_str + first_good_char_pos, stripped_len);
|
||||
memcpy(stripped_str, orig_str + first_good_char_pos, stripped_len);
|
||||
stripped_str[stripped_len] = '\0';
|
||||
return mp_obj_new_str(qstr_from_str_take(stripped_str, stripped_len + 1));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user