[libvirt] [PATCH 01/11] util: buffer: Tolerate NULL 'buf' in virBufferStrcat

Peter Krempa posted 11 patches 7 years, 1 month ago
[libvirt] [PATCH 01/11] util: buffer: Tolerate NULL 'buf' in virBufferStrcat
Posted by Peter Krempa 7 years, 1 month ago
Most other buffer APIs tolerate the buffer being NULL.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/util/virbuffer.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c
index 1a6bf122e0..3d6defb73a 100644
--- a/src/util/virbuffer.c
+++ b/src/util/virbuffer.c
@@ -883,6 +883,9 @@ virBufferStrcat(virBufferPtr buf, ...)
 {
     va_list ap;

+    if (!buf)
+        return;
+
     va_start(ap, buf);
     virBufferStrcatVArgs(buf, ap);
     va_end(ap);
-- 
2.16.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 01/11] util: buffer: Tolerate NULL 'buf' in virBufferStrcat
Posted by Ján Tomko 7 years, 1 month ago
On Thu, Mar 22, 2018 at 07:31:38PM +0100, Peter Krempa wrote:
>Most other buffer APIs tolerate the buffer being NULL.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/util/virbuffer.c | 3 +++
> 1 file changed, 3 insertions(+)
>

ACK

Jan
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list