upstream: allow sshbuf_put_stringb(buf, NULL); ok markus@

OpenBSD-Commit-ID: 91482c1ada9adb283165d48dafbb88ae91c657bd
This commit is contained in:
djm@openbsd.org 2019-12-13 19:09:37 +00:00 committed by Damien Miller
parent b52ec0ba39
commit 612b1dd1ec
1 changed files with 4 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sshbuf-getput-basic.c,v 1.9 2019/09/06 04:53:27 djm Exp $ */ /* $OpenBSD: sshbuf-getput-basic.c,v 1.10 2019/12/13 19:09:37 djm Exp $ */
/* /*
* Copyright (c) 2011 Damien Miller * Copyright (c) 2011 Damien Miller
* *
@ -535,6 +535,9 @@ sshbuf_put_cstring(struct sshbuf *buf, const char *v)
int int
sshbuf_put_stringb(struct sshbuf *buf, const struct sshbuf *v) sshbuf_put_stringb(struct sshbuf *buf, const struct sshbuf *v)
{ {
if (v == NULL)
return sshbuf_put_string(buf, NULL, 0);
return sshbuf_put_string(buf, sshbuf_ptr(v), sshbuf_len(v)); return sshbuf_put_string(buf, sshbuf_ptr(v), sshbuf_len(v));
} }