@@ -158,25 +158,25 @@ int main(int argc, char **argv) {
158158
159159 char buffer[(NROWS + 2 ) * (NCOLS + 2 )];
160160 char *offset = buffer;
161- sprintf (offset, " +" );
161+ snprintf (offset, 2 , " +" );
162162 for (size_t col = 0 ; col < NCOLS; ++col) {
163- sprintf (offset + col + 1 , " -" );
163+ snprintf (offset + col + 1 , 2 , " -" );
164164 }
165- sprintf (buffer + NCOLS + 1 , " +\n " );
165+ snprintf (buffer + NCOLS + 1 , 3 , " +\n " );
166166 offset += NCOLS + 3 ;
167167 for (size_t row = 0 ; row < NROWS; ++row) {
168- sprintf (offset, " |" );
168+ snprintf (offset, 2 , " |" );
169169 for (size_t col = 0 ; col < NCOLS; ++col) {
170- sprintf (offset + col + 1 , " %c" , raster[row * NCOLS + col]);
170+ snprintf (offset + col + 1 , 2 , " %c" , raster[row * NCOLS + col]);
171171 }
172- sprintf (offset + NCOLS + 1 , " |\n " );
172+ snprintf (offset + NCOLS + 1 , 3 , " |\n " );
173173 offset += NCOLS + 3 ;
174174 }
175- sprintf (offset, " +" );
175+ snprintf (offset, 2 , " +" );
176176 for (size_t col = 0 ; col < NCOLS; ++col) {
177- sprintf (offset + col + 1 , " -" );
177+ snprintf (offset + col + 1 , 2 , " -" );
178178 }
179- sprintf (offset + NCOLS + 1 , " +\n " );
179+ snprintf (offset + NCOLS + 1 , 3 , " +\n " );
180180 printf (" \033 [H\033 [HWorkgroup size: %zu %zu %zu \n Number of Threads: %zu "
181181 " %zu %d \n %s" ,
182182 code.workgroupSize [0 ], code.workgroupSize [1 ], code.workgroupSize [2 ],
0 commit comments