1
0
mirror of https://github.com/openbsd/src.git synced 2026-06-18 15:23:33 +02:00

Check for \0 after skipping # not before in format_expand1, from ossfuzz.

This commit is contained in:
nicm
2026-04-02 08:37:14 +00:00
parent 012a125b6d
commit 228dbe0fa0
2 changed files with 8 additions and 7 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: format.c,v 1.349 2026/03/27 08:40:26 nicm Exp $ */
/* $OpenBSD: format.c,v 1.350 2026/04/02 08:37:14 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -5444,7 +5444,7 @@ format_expand1(struct format_expand_state *es, const char *fmt)
buf[off++] = *fmt++;
continue;
}
if (*fmt++ == '\0')
if (*++fmt == '\0')
break;
ch = (u_char)*fmt++;
+6 -5
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: window-copy.c,v 1.392 2026/03/30 09:23:40 nicm Exp $ */
/* $OpenBSD: window-copy.c,v 1.393 2026/04/02 08:37:14 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -3333,7 +3333,7 @@ window_copy_command(struct window_mode_entry *wme, struct client *c,
enum window_copy_cmd_clear clear = WINDOW_COPY_CMD_CLEAR_NEVER;
const char *command;
u_int i, count = args_count(args);
int keys;
int keys, flags;
char *error = NULL;
if (count == 0)
@@ -3355,9 +3355,10 @@ window_copy_command(struct window_mode_entry *wme, struct client *c,
action = WINDOW_COPY_CMD_NOTHING;
for (i = 0; i < nitems(window_copy_cmd_table); i++) {
if (strcmp(window_copy_cmd_table[i].command, command) == 0) {
if (c->flags & CLIENT_READONLY &&
(~window_copy_cmd_table[i].flags &
WINDOW_COPY_CMD_FLAG_READONLY)) {
flags = window_copy_cmd_table[i].flags;
if (c != NULL &&
c->flags & CLIENT_READONLY &&
(~flags & WINDOW_COPY_CMD_FLAG_READONLY)) {
status_message_set(c, -1, 1, 0, 0,
"client is read-only");
return;