Replace comment with static assert.

Addressing review comment in
https://boringssl-review.googlesource.com/c/boringssl/+/55449/1/crypto/asn1/a_strex.c

Bug: 516
Change-Id: I97a74b2d6b041961a573c124c69748e01c0e49d8
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/55505
Reviewed-by: Bob Beck <bbe@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
fips-20230428
David Benjamin 2 years ago committed by Boringssl LUCI CQ
parent b15e56a694
commit 1e63b0ce53
  1. 4
      crypto/asn1/a_strex.c

@ -59,6 +59,7 @@
#include <assert.h>
#include <ctype.h>
#include <inttypes.h>
#include <limits.h>
#include <string.h>
#include <time.h>
@ -121,7 +122,8 @@ static int do_esc_char(uint32_t c, unsigned long flags, char *do_quotes,
return maybe_write(out, &u8, 1) ? 1 : -1;
}
int len = (int)strlen(buf); // |buf| is guaranteed to be short.
static_assert(sizeof(buf) < INT_MAX, "len may not fit in int");
int len = (int)strlen(buf);
return maybe_write(out, buf, len) ? len : -1;
}

Loading…
Cancel
Save