conv: prevent theoretical NULL pointer dereference in osmo_conv_encode()

A caller shall never pass NULL to osmo_conv_encode().

Change-Id: Ice0050cd7c7e3fcbf57c2c73682ca28843a92d8b
Fixes: CID#208174
This commit is contained in:
Vadim Yanitskiy 2020-02-09 04:12:53 +07:00
parent df4f6085cd
commit a8809f0a16
1 changed files with 2 additions and 0 deletions

View File

@ -36,6 +36,7 @@
#include <stdlib.h>
#include <string.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/bits.h>
#include <osmocom/core/conv.h>
@ -87,6 +88,7 @@ osmo_conv_encode_init(struct osmo_conv_encoder *encoder,
const struct osmo_conv_code *code)
{
memset(encoder, 0x00, sizeof(struct osmo_conv_encoder));
OSMO_ASSERT(code != NULL);
encoder->code = code;
}