=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/input.c,v retrieving revision 1.215 retrieving revision 1.216 diff -c -r1.215 -r1.216 *** src/usr.bin/tmux/input.c 2023/06/25 15:53:07 1.215 --- src/usr.bin/tmux/input.c 2023/06/30 13:19:32 1.216 *************** *** 1,4 **** ! /* $OpenBSD: input.c,v 1.215 2023/06/25 15:53:07 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: input.c,v 1.216 2023/06/30 13:19:32 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 2842,2850 **** const char *end) { char *out = NULL; ! size_t outlen = 0; if (buf != NULL && len != 0) { outlen = 4 * ((len + 2) / 3) + 1; out = xmalloc(outlen); if ((outlen = b64_ntop(buf, len, out, outlen)) == -1) { --- 2842,2852 ---- const char *end) { char *out = NULL; ! int outlen = 0; if (buf != NULL && len != 0) { + if (len >= ((size_t)INT_MAX * 3 / 4) - 1) + return; outlen = 4 * ((len + 2) / 3) + 1; out = xmalloc(outlen); if ((outlen = b64_ntop(buf, len, out, outlen)) == -1) {