Deleted Added
full compact
sshbuf-getput-basic.c (302408) sshbuf-getput-basic.c (323129)
1/* $OpenBSD: sshbuf-getput-basic.c,v 1.5 2015/10/20 23:24:25 mmcc Exp $ */
1/* $OpenBSD: sshbuf-getput-basic.c,v 1.6 2016/06/16 11:00:17 dtucker Exp $ */
2/*
3 * Copyright (c) 2011 Damien Miller
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 4 unchanged lines hidden (view full) ---

14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#define SSHBUF_INTERNAL
19#include "includes.h"
20
21#include <sys/types.h>
2/*
3 * Copyright (c) 2011 Damien Miller
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 4 unchanged lines hidden (view full) ---

14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#define SSHBUF_INTERNAL
19#include "includes.h"
20
21#include <sys/types.h>
22
23#include <stdarg.h>
22#include <stdlib.h>
23#include <stdio.h>
24#include <string.h>
25
26#include "ssherr.h"
27#include "sshbuf.h"
28
29int

--- 233 unchanged lines hidden (view full) ---

263
264int
265sshbuf_putfv(struct sshbuf *buf, const char *fmt, va_list ap)
266{
267 va_list ap2;
268 int r, len;
269 u_char *p;
270
24#include <stdlib.h>
25#include <stdio.h>
26#include <string.h>
27
28#include "ssherr.h"
29#include "sshbuf.h"
30
31int

--- 233 unchanged lines hidden (view full) ---

265
266int
267sshbuf_putfv(struct sshbuf *buf, const char *fmt, va_list ap)
268{
269 va_list ap2;
270 int r, len;
271 u_char *p;
272
271 va_copy(ap2, ap);
273 VA_COPY(ap2, ap);
272 if ((len = vsnprintf(NULL, 0, fmt, ap2)) < 0) {
273 r = SSH_ERR_INVALID_ARGUMENT;
274 goto out;
275 }
276 if (len == 0) {
277 r = 0;
278 goto out; /* Nothing to do */
279 }
280 va_end(ap2);
274 if ((len = vsnprintf(NULL, 0, fmt, ap2)) < 0) {
275 r = SSH_ERR_INVALID_ARGUMENT;
276 goto out;
277 }
278 if (len == 0) {
279 r = 0;
280 goto out; /* Nothing to do */
281 }
282 va_end(ap2);
281 va_copy(ap2, ap);
283 VA_COPY(ap2, ap);
282 if ((r = sshbuf_reserve(buf, (size_t)len + 1, &p)) < 0)
283 goto out;
284 if ((r = vsnprintf((char *)p, len + 1, fmt, ap2)) != len) {
285 r = SSH_ERR_INTERNAL_ERROR;
286 goto out; /* Shouldn't happen */
287 }
288 /* Consume terminating \0 */
289 if ((r = sshbuf_consume_end(buf, 1)) != 0)

--- 173 unchanged lines hidden ---
284 if ((r = sshbuf_reserve(buf, (size_t)len + 1, &p)) < 0)
285 goto out;
286 if ((r = vsnprintf((char *)p, len + 1, fmt, ap2)) != len) {
287 r = SSH_ERR_INTERNAL_ERROR;
288 goto out; /* Shouldn't happen */
289 }
290 /* Consume terminating \0 */
291 if ((r = sshbuf_consume_end(buf, 1)) != 0)

--- 173 unchanged lines hidden ---