libyang BUGFIX avoid invalid parameters for memmove and memcpy
diff --git a/src/out.c b/src/out.c
index 898d663..4590f26 100644
--- a/src/out.c
+++ b/src/out.c
@@ -433,7 +433,9 @@
             *out->method.mem.buf = aux;
             out->method.mem.size = out->method.mem.len + written + 1;
         }
-        memcpy(&(*out->method.mem.buf)[out->method.mem.len], msg, written);
+        if (written) {
+            memcpy(&(*out->method.mem.buf)[out->method.mem.len], msg, written);
+        }
         out->method.mem.len += written;
         (*out->method.mem.buf)[out->method.mem.len] = '\0';
         free(msg);
@@ -542,7 +544,9 @@
             out->buf_size = out->buf_len + len;
         }
 
-        memcpy(&out->buffered[out->buf_len], buf, len);
+        if (len) {
+            memcpy(&out->buffered[out->buf_len], buf, len);
+        }
         out->buf_len += len;
 
         out->printed += len;
@@ -563,7 +567,9 @@
             }
             out->method.mem.size = out->method.mem.len + len + 1;
         }
-        memcpy(&(*out->method.mem.buf)[out->method.mem.len], buf, len);
+        if (len) {
+            memcpy(&(*out->method.mem.buf)[out->method.mem.len], buf, len);
+        }
         out->method.mem.len += len;
         (*out->method.mem.buf)[out->method.mem.len] = '\0';
 
@@ -704,6 +710,8 @@
 {
     LY_ERR ret = LY_SUCCESS;
 
+    assert(count);
+
     switch (out->type) {
     case LY_OUT_MEMORY:
         /* write */