-/* $OpenBSD: bs_cbs.c,v 1.4 2015/04/29 01:16:06 doug Exp $ */
+/* $OpenBSD: bs_cbs.c,v 1.5 2015/04/29 01:23:20 doug Exp $ */
/*
* Copyright (c) 2014, Google Inc.
*
size_t i;
const uint8_t *data;
+ if (len < 1 || len > 4)
+ return 0;
+
if (!cbs_get(cbs, &data, len))
return 0;
-/* $OpenBSD: bs_cbs.c,v 1.4 2015/04/29 01:16:06 doug Exp $ */
+/* $OpenBSD: bs_cbs.c,v 1.5 2015/04/29 01:23:20 doug Exp $ */
/*
* Copyright (c) 2014, Google Inc.
*
size_t i;
const uint8_t *data;
+ if (len < 1 || len > 4)
+ return 0;
+
if (!cbs_get(cbs, &data, len))
return 0;