diff options
author | iphydf <iphydf@users.noreply.github.com> | 2017-01-20 21:16:55 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2017-01-28 20:49:12 +0000 |
commit | 6ae33c16cf9e37fda85d70c78b3c2779eb8ca21a (patch) | |
tree | 99c3a8c26e02039b515bb6f57d2797d1cdf77c1d /toxcore/friend_requests.c | |
parent | 895de7ef26e7617769f2271345e414545c2581f8 (diff) |
Add VLA compatibility macro for C89-ish compilers.
Diffstat (limited to 'toxcore/friend_requests.c')
-rw-r--r-- | toxcore/friend_requests.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/toxcore/friend_requests.c b/toxcore/friend_requests.c index eedd2051..ba782e2b 100644 --- a/toxcore/friend_requests.c +++ b/toxcore/friend_requests.c | |||
@@ -138,9 +138,9 @@ static int friendreq_handlepacket(void *object, const uint8_t *source_pubkey, co | |||
138 | addto_receivedlist(fr, source_pubkey); | 138 | addto_receivedlist(fr, source_pubkey); |
139 | 139 | ||
140 | uint32_t message_len = length - sizeof(fr->nospam); | 140 | uint32_t message_len = length - sizeof(fr->nospam); |
141 | uint8_t message[message_len + 1]; | 141 | VLA(uint8_t, message, message_len + 1); |
142 | memcpy(message, packet + sizeof(fr->nospam), message_len); | 142 | memcpy(message, packet + sizeof(fr->nospam), message_len); |
143 | message[sizeof(message) - 1] = 0; /* Be sure the message is null terminated. */ | 143 | message[SIZEOF_VLA(message) - 1] = 0; /* Be sure the message is null terminated. */ |
144 | 144 | ||
145 | (*fr->handle_friendrequest)(fr->handle_friendrequest_object, source_pubkey, message, message_len, userdata); | 145 | (*fr->handle_friendrequest)(fr->handle_friendrequest_object, source_pubkey, message, message_len, userdata); |
146 | return 0; | 146 | return 0; |