avoid-puts-use-printf
Use when using puts() function for string output
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Menu
Use when using puts() function for string output
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Basé sur la classification professionnelle SOC
Use when printf statements output strings without trailing newlines
Use when array is accessed with direct user input as index (0-based indexing)
Use when the program accesses a precomputed table using an offset (e.g., arr[n-1]) that introduces an arithmetic operation between the symbolic input and the index
Use when loop variables iterate over character values (e.g., ASCII codes) to represent different operations or choices
Use when code uses a loop to search for an input value in an array and then uses the found index for further computation
Use when code reads a fixed number of characters into an array and only accesses individual elements
| name | avoid-puts-use-printf |
| description | Use when using puts() function for string output |
A KLEE-coverage code transformation. Applying it rewrites C source so symbolic execution explores more of the program's behavior.
When using puts() function for string output
Replace puts() calls with printf() calls, adding explicit newline characters where needed
KLEE may have better symbolic modeling for printf() than puts(), allowing more efficient constraint solving and path exploration during symbolic execution
Before:
#include <stdio.h>
int main(){
int X;
scanf("%d", &X);
if(X ==3 || X==5 || X==7) puts("YES");
else puts("NO");
return 0;
}
After:
#include<stdio.h>
int main(void) {
int X;
scanf("%d", &X);
if (X == 3 || X == 5 || X == 7)
printf("YES\n");
else
printf("NO");
}
0754077b