diff options
Diffstat (limited to 'core/Messenger.c')
-rw-r--r-- | core/Messenger.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/Messenger.c b/core/Messenger.c index eb151a6a..af102406 100644 --- a/core/Messenger.c +++ b/core/Messenger.c | |||
@@ -269,10 +269,18 @@ int setname(Messenger *m, uint8_t * name, uint16_t length) | |||
269 | put it in name | 269 | put it in name |
270 | name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH bytes. | 270 | name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH bytes. |
271 | return the length of the name */ | 271 | return the length of the name */ |
272 | uint16_t getself_name(Messenger *m, uint8_t *name) | 272 | uint16_t getself_name(Messenger *m, uint8_t *name, uint16_t nlen) |
273 | { | 273 | { |
274 | uint16_t len; | ||
275 | |||
276 | if (name == NULL || nlen == 0) { | ||
277 | return 0; | ||
278 | } | ||
279 | |||
280 | len = MIN(nlen, m->name_length); | ||
274 | memcpy(name, m->name, m->name_length); | 281 | memcpy(name, m->name, m->name_length); |
275 | return m->name_length; | 282 | |
283 | return len; | ||
276 | } | 284 | } |
277 | 285 | ||
278 | /* get name of friendnumber | 286 | /* get name of friendnumber |