summaryrefslogtreecommitdiff
path: root/lib/ofpbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ofpbuf.c')
-rw-r--r--lib/ofpbuf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ofpbuf.c b/lib/ofpbuf.c
index 4edb3c114..271105bde 100644
--- a/lib/ofpbuf.c
+++ b/lib/ofpbuf.c
@@ -384,6 +384,10 @@ ofpbuf_put_zeros(struct ofpbuf *b, size_t size)
void *
ofpbuf_put(struct ofpbuf *b, const void *p, size_t size)
{
+ if (!size) {
+ return ofpbuf_tail(b);
+ }
+
void *dst = ofpbuf_put_uninit(b, size);
memcpy(dst, p, size);
return dst;