Fix: memcpy used on potentially overlapping regions
[lttng-tools.git] / src / bin / lttng-sessiond / notification-thread-events.c
index bdbac0c4001f44f218ea0821eab5891972d35043..24bc2482ade2590a802057a3e7dd334c01f16220 100644 (file)
@@ -928,7 +928,10 @@ int evaluate_condition_for_client(const struct lttng_trigger *trigger,
                ret = -1;
                goto end;
        }
-
+       if (ret) {
+               /* Fatal error. */
+               goto end;
+       }
        if (!evaluation) {
                /* Evaluation yielded nothing. Normal exit. */
                DBG("[notification-thread] Newly subscribed-to condition evaluated to false, nothing to report to client");
@@ -2571,13 +2574,12 @@ int client_flush_outgoing_queue(struct notification_client *client,
        ret = lttcomm_send_unix_sock_non_block(client->socket,
                        client->communication.outbound.buffer.data,
                        to_send_count);
-       if ((ret < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) ||
-                       (ret > 0 && ret < to_send_count)) {
+       if ((ret >= 0 && ret < to_send_count)) {
                DBG("[notification-thread] Client (socket fd = %i) outgoing queue could not be completely flushed",
                                client->socket);
                to_send_count -= max(ret, 0);
 
-               memcpy(client->communication.outbound.buffer.data,
+               memmove(client->communication.outbound.buffer.data,
                                client->communication.outbound.buffer.data +
                                client->communication.outbound.buffer.size - to_send_count,
                                to_send_count);
This page took 0.025093 seconds and 4 git commands to generate.