Index: funcs/func_strings.c =================================================================== --- funcs/func_strings.c (revision 137113) +++ funcs/func_strings.c (working copy) @@ -300,8 +300,13 @@ formatbuf[&arg.format[i] - formatstart + 1] = '\0'; /* Convert the argument into the required type */ - if (sscanf(arg.var[argcount++], "%d", &tmpi) != 1) { - ast_log(LOG_ERROR, "Argument '%s' is not an integer number for format '%s'\n", arg.var[argcount - 1], formatbuf); + if (arg.var[argcount]) { + if (sscanf(arg.var[argcount++], "%d", &tmpi) != 1) { + ast_log(LOG_ERROR, "Argument '%s' is not an integer number for format '%s'\n", arg.var[argcount - 1], formatbuf); + goto sprintf_fail; + } + } else { + ast_log(LOG_ERROR, "SPRINTF() has more format specifiers than arguments!\n"); goto sprintf_fail; } @@ -318,8 +323,13 @@ formatbuf[&arg.format[i] - formatstart + 1] = '\0'; /* Convert the argument into the required type */ - if (sscanf(arg.var[argcount++], "%lf", &tmpd) != 1) { - ast_log(LOG_ERROR, "Argument '%s' is not a floating point number for format '%s'\n", arg.var[argcount - 1], formatbuf); + if (arg.var[argcount]) { + if (sscanf(arg.var[argcount++], "%lf", &tmpd) != 1) { + ast_log(LOG_ERROR, "Argument '%s' is not a floating point number for format '%s'\n", arg.var[argcount - 1], formatbuf); + goto sprintf_fail; + } + } else { + ast_log(LOG_ERROR, "SPRINTF() has more format specifiers than arguments!\n"); goto sprintf_fail; }