]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolve: add missing OOM check
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 18 Apr 2026 22:33:17 +0000 (07:33 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 18 Apr 2026 22:33:17 +0000 (07:33 +0900)
src/resolve/resolved-dnstls.c

index 09dda4508b81f423945dab59677c18bf24160bd4..bfc6a72183199e691c87c77b307e351268b16048 100644 (file)
@@ -333,6 +333,9 @@ ssize_t dnstls_stream_writev(DnsStream *stream, const struct iovec *iov, size_t
            single buffer. Suboptimal, but better than multiple SSL_write calls. */
         count = iovec_total_size(iov, iovcnt);
         buf = new(char, count);
+        if (!buf)
+                return -ENOMEM;
+
         for (size_t i = 0, pos = 0; i < iovcnt; pos += iov[i].iov_len, i++)
                 memcpy(buf + pos, iov[i].iov_base, iov[i].iov_len);