diff --git a/main/pbx.c b/main/pbx.c
index b4a54486dd72d78e27cecb65b65b7ddb07f07cc6..911aaab8ae9b5b1e15055fa7679f41ce8046504d 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -8616,6 +8616,7 @@ static int pbx_parseable_goto(struct ast_channel *chan, const char *goto_string,
 	char *stringp;
 	int ipri;
 	int mode = 0;
+	char rest[2] = "";
 
 	if (ast_strlen_zero(goto_string)) {
 		ast_log(LOG_WARNING, "Goto requires an argument ([[context,]extension,]priority)\n");
@@ -8641,7 +8642,7 @@ static int pbx_parseable_goto(struct ast_channel *chan, const char *goto_string,
 		mode = -1;
 		pri++;
 	}
-	if (sscanf(pri, "%30d", &ipri) != 1) {
+	if (sscanf(pri, "%30d%1s", &ipri, rest) != 1) {
 		ipri = ast_findlabel_extension(chan, context ? context : ast_channel_context(chan),
 			exten ? exten : ast_channel_exten(chan), pri,
 			S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL));