X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Ftest_sgr.c;h=509033ed777444b37c94c99c531425e5375664fd;hp=aa7a649ba778415b1beedadb3dd401b866f102cf;hb=e2e9c09c48b19b24979cafb2d4864f538b5ddd1c;hpb=603f0cb25b7acc8f04f4b18d2a2fe6f90039829a diff --git a/test/test_sgr.c b/test/test_sgr.c index aa7a649b..509033ed 100644 --- a/test/test_sgr.c +++ b/test/test_sgr.c @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey * - * $Id: test_sgr.c,v 1.7 2016/06/11 23:15:03 tom Exp $ + * $Id: test_sgr.c,v 1.8 2016/09/04 23:30:56 tom Exp $ * * A simple demo of the sgr/sgr0 terminal capabilities. */ @@ -61,8 +61,9 @@ static long total_values; static char * make_dbitem(char *p, char *q) { - char *result = malloc(strlen(e_opt) + 2 + (size_t) (p - q)); - sprintf(result, "%s=%.*s", e_opt, (int) (p - q), q); + size_t need = strlen(e_opt) + 2 + (size_t) (p - q); + char *result = malloc(need); + _nc_SPRINTF(result, _nc_SLIMIT(need) "%s=%.*s", e_opt, (int) (p - q), q); return result; }