From 1fbc67a40a816e4e8a6f8d6bcf2f6e500dd09471 Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Sun, 13 Sep 2015 20:46:14 -0700 Subject: [PATCH] Fix pointer indirection precedence issue in docs Without this change, a segmentation fault is likely to occur when using the proposed snippet of code, as `*address[size]` is equivalent to `*(address[size])`, not `(*address)[size]` as clearly intended. --- doc/zmq_socket_monitor.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/zmq_socket_monitor.txt b/doc/zmq_socket_monitor.txt index ffee2abb..3d37b54f 100644 --- a/doc/zmq_socket_monitor.txt +++ b/doc/zmq_socket_monitor.txt @@ -150,7 +150,7 @@ get_monitor_event (void *monitor, int *value, char **address) size_t size = zmq_msg_size (&msg); *address = (char *) malloc (size + 1); memcpy (*address, data, size); - *address [size] = 0; + (*address)[size] = 0; } return event; }