summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-12-02 19:02:02 -0500
committerirungentoo <irungentoo@gmail.com>2014-12-02 19:02:02 -0500
commit505bab76bda97a9098df27115fa4fff861d1140f (patch)
tree3e787bc5de018558ce059d7c91151bbe7b08deaf
parent2ef9ef5d43cde382f43007c039824c1ae7d5b0f5 (diff)
Only copy when pointer isn't NULL in get_friendcon_public_keys().
-rw-r--r--toxcore/friend_connection.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/toxcore/friend_connection.c b/toxcore/friend_connection.c
index aca64e5a..aaffe02f 100644
--- a/toxcore/friend_connection.c
+++ b/toxcore/friend_connection.c
@@ -419,8 +419,12 @@ int get_friendcon_public_keys(uint8_t *real_pk, uint8_t *dht_temp_pk, Friend_Con
419 if (!friend_con) 419 if (!friend_con)
420 return -1; 420 return -1;
421 421
422 memcpy(real_pk, friend_con->real_public_key, crypto_box_PUBLICKEYBYTES); 422 if (real_pk)
423 memcpy(dht_temp_pk, friend_con->dht_temp_pk, crypto_box_PUBLICKEYBYTES); 423 memcpy(real_pk, friend_con->real_public_key, crypto_box_PUBLICKEYBYTES);
424
425 if (dht_temp_pk)
426 memcpy(dht_temp_pk, friend_con->dht_temp_pk, crypto_box_PUBLICKEYBYTES);
427
424 return 0; 428 return 0;
425} 429}
426 430