From 0dd5c323fae7881577963ce77012e317db19af88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Courr=C3=A8ges-Anglas?= Date: Mon, 3 Mar 2014 20:52:03 +0100 Subject: In read_frame, don't silently ignore invalid/unknown frame selectors. --- src/actions.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/actions.c b/src/actions.c index f9be566..5ac17a2 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1769,7 +1769,6 @@ read_shellcmd (struct argspec *spec, struct sbuf *s, struct cmdarg **arg, const return ret; } -/* Return NULL on abort/failure. */ static cmdret * read_frame (struct sbuf *s, struct cmdarg **arg) { @@ -1851,16 +1850,21 @@ read_frame (struct sbuf *s, struct cmdarg **arg) { fnum = frame_selector_match (keysym_buf[0]); if (fnum == -1) - goto frame_fail; + return cmdret_new (RET_FAILURE, "unknown frame selector `%s'", + keysym_buf); } else { - goto frame_fail; + return cmdret_new (RET_FAILURE, "frame selector too long `%s'", + keysym_buf); } } else { fnum = string_to_positive_int (sbuf_get (s)); + if (fnum == -1) + return cmdret_new (RET_FAILURE, "invalid frame selector `%s'," + " negative or too big", sbuf_get (s)); } /* Now that we have a frame number to go to, let's try to jump to it. */ @@ -1876,11 +1880,8 @@ read_frame (struct sbuf *s, struct cmdarg **arg) (*arg)->arg.frame = frame; return NULL; } - - - frame_fail: - *arg = NULL; - return cmdret_new (RET_SUCCESS, NULL); + else + return cmdret_new (RET_FAILURE, "frame not found"); } static cmdret * -- cgit v1.2.3