Download scripts/escape_wfix.diff from shawnnnliu/Hardened_SEC-Bench: direct link, hf CLI and curl.
- Browser
- Download file 980 Bytes
-
https://huggingface.co/datasets/shawnnnliu/Hardened_SEC-Bench/resolve/main/scripts/escape_wfix.diff
- Command line
-
hf download hf://datasets/shawnnnliu/Hardened_SEC-Bench/scripts/escape_wfix.diff
-
curl -L -o escape_wfix.diff https://huggingface.co/datasets/shawnnnliu/Hardened_SEC-Bench/resolve/main/scripts/escape_wfix.diff
980 Bytes
| diff --git a/programs/escape.c b/programs/escape.c | |
| index 4d409ea4..0bf9656c 100644 | |
| --- a/programs/escape.c | |
| +++ b/programs/escape.c | |
| htmlwescape (BITCODE_TU wstr) | |
| while ((c = *tmp++)) | |
| len++; | |
| len += 16; | |
| - d = dest = malloc (len); | |
| + d = dest = calloc (len, 1); | |
| - while (*wstr++) | |
| + while (*wstr) | |
| { | |
| const int off = d - dest; | |
| if (off >= len - 8) | |
| htmlwescape (BITCODE_TU wstr) | |
| len += 16; | |
| dest = realloc (dest, len); | |
| d = dest + off; | |
| + *d = 0; | |
| } | |
| switch (*wstr) | |
| { | |
| htmlwescape (BITCODE_TU wstr) | |
| { | |
| sprintf (d, "&#x%X;", *wstr); | |
| d += strlen (d); | |
| + *d = 0; | |
| } | |
| else if (*wstr >= 20) | |
| - *d++ = *wstr; | |
| + { | |
| + *d++ = *wstr; | |
| + *d = 0; | |
| + } | |
| } | |
| + wstr++; | |
| } | |
| *d = 0; | |
| return dest; | |