aboutsummaryrefslogtreecommitdiff
path: root/lib/alloc/bufalloc_noterm.c
blob: e46d2a1616ee1a865943c2a3c5c5a608750baa26 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <errno.h>
#include <stdckdint.h>
#include <stdlib.h>

#include "alloc.h"

void *
bufalloc_noterm(void *p, size_t n, size_t m)
{
	if (ckd_mul(&n, n, m)) {
		errno = EOVERFLOW;
		return nullptr;
	}

	return realloc(p, n);
}