summaryrefslogtreecommitdiff
path: root/sshbuf.c
diff options
context:
space:
mode:
authorderaadt@openbsd.org <deraadt@openbsd.org>2016-09-12 01:22:38 +0000
committerDarren Tucker <dtucker@zip.com.au>2016-09-12 13:46:29 +1000
commit9136ec134c97a8aff2917760c03134f52945ff3c (patch)
treebfcab357e6e0f510d9b63bac43b18097e89fa58a /sshbuf.c
parentf219fc8f03caca7ac82a38ed74bbd6432a1195e7 (diff)
upstream commit
Add MAXIMUM(), MINIMUM(), and ROUNDUP() to misc.h, then use those definitions rather than pulling <sys/param.h> and unknown namespace pollution. ok djm markus dtucker Upstream-ID: 712cafa816c9f012a61628b66b9fbd5687223fb8
Diffstat (limited to 'sshbuf.c')
-rw-r--r--sshbuf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sshbuf.c b/sshbuf.c
index 4d6e0ea0a..91cbd067c 100644
--- a/sshbuf.c
+++ b/sshbuf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshbuf.c,v 1.6 2016/01/12 23:42:54 djm Exp $ */ 1/* $OpenBSD: sshbuf.c,v 1.7 2016/09/12 01:22:38 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller 3 * Copyright (c) 2011 Damien Miller
4 * 4 *
@@ -18,7 +18,6 @@
18#define SSHBUF_INTERNAL 18#define SSHBUF_INTERNAL
19#include "includes.h" 19#include "includes.h"
20 20
21#include <sys/param.h> /* roundup */
22#include <sys/types.h> 21#include <sys/types.h>
23#include <signal.h> 22#include <signal.h>
24#include <stdlib.h> 23#include <stdlib.h>
@@ -27,6 +26,7 @@
27 26
28#include "ssherr.h" 27#include "ssherr.h"
29#include "sshbuf.h" 28#include "sshbuf.h"
29#include "misc.h"
30 30
31static inline int 31static inline int
32sshbuf_check_sanity(const struct sshbuf *buf) 32sshbuf_check_sanity(const struct sshbuf *buf)
@@ -250,7 +250,7 @@ sshbuf_set_max_size(struct sshbuf *buf, size_t max_size)
250 if (buf->size < SSHBUF_SIZE_INIT) 250 if (buf->size < SSHBUF_SIZE_INIT)
251 rlen = SSHBUF_SIZE_INIT; 251 rlen = SSHBUF_SIZE_INIT;
252 else 252 else
253 rlen = roundup(buf->size, SSHBUF_SIZE_INC); 253 rlen = ROUNDUP(buf->size, SSHBUF_SIZE_INC);
254 if (rlen > max_size) 254 if (rlen > max_size)
255 rlen = max_size; 255 rlen = max_size;
256 explicit_bzero(buf->d + buf->size, buf->alloc - buf->size); 256 explicit_bzero(buf->d + buf->size, buf->alloc - buf->size);
@@ -340,7 +340,7 @@ sshbuf_reserve(struct sshbuf *buf, size_t len, u_char **dpp)
340 * allocate less if doing so would overflow max_size. 340 * allocate less if doing so would overflow max_size.
341 */ 341 */
342 need = len + buf->size - buf->alloc; 342 need = len + buf->size - buf->alloc;
343 rlen = roundup(buf->alloc + need, SSHBUF_SIZE_INC); 343 rlen = ROUNDUP(buf->alloc + need, SSHBUF_SIZE_INC);
344 SSHBUF_DBG(("need %zu initial rlen %zu", need, rlen)); 344 SSHBUF_DBG(("need %zu initial rlen %zu", need, rlen));
345 if (rlen > buf->max_size) 345 if (rlen > buf->max_size)
346 rlen = buf->alloc + need; 346 rlen = buf->alloc + need;