| 244 | } |
| 245 | |
| 246 | bool cbm_validate_shell_arg(const char *s) { |
| 247 | if (!s) { |
| 248 | return false; |
| 249 | } |
| 250 | for (const char *p = s; *p; p++) { |
| 251 | switch (*p) { |
| 252 | case '\'': |
| 253 | case '"': |
| 254 | case ';': |
| 255 | case '|': |
| 256 | case '&': |
| 257 | case '$': |
| 258 | case '`': |
| 259 | case '<': |
| 260 | case '>': |
| 261 | case '\n': |
| 262 | case '\r': |
| 263 | #ifndef _WIN32 |
| 264 | case '\\': |
| 265 | #endif |
| 266 | return false; |
| 267 | default: |
| 268 | break; |
| 269 | } |
| 270 | } |
| 271 | return true; |
| 272 | } |
| 273 | |
| 274 | bool cbm_validate_shell_path_arg(const char *path) { |
| 275 | if (!cbm_validate_shell_arg(path)) { |
no outgoing calls
no test coverage detected