/* Skip space from line begin */ while (my_isspace(charset_info, *line)) line++; shell_cmd = strchr(line, ' '); if (!shell_cmd) { put_info("Usage: \\! shell-command", INFO_ERROR); return -1; }
if (!opt_system_command) { returnput_info( "'system' command received, but the --system-command option is off. " "Skipping.", INFO_ERROR); } /* The output of the shell command does not get directed to the pager or the outfile */ if (system(shell_cmd) == -1) { put_info(strerror(errno), INFO_ERROR, errno); return -1; } return0; } opt_server_version = mysql_get_server_version(mysql);
staticvoidget_safe_server_info(char *safe_server_info, size_t safe_server_info_len) { const char *server_info = mysql_get_server_info(&mysql_connection); if (server_info == nullptr) { safe_server_info[0] = 0; return; } DBUG_EXECUTE_IF("server_version_injection_test", { const char *payload = "8.0.0-injection_test\n\\! touch /tmp/xxx"; server_info = payload; }); for (size_t i = 0; i < safe_server_info_len; ++i) { // End of string. if (server_info[i] == 0) { safe_server_info[i] = 0; return; } // Version may include only alphanumeric and punctuation characters. // Cut off the rest of the string if incorrect character found. if (!(isalnum(server_info[i]) || ispunct(server_info[i]))) { safe_server_info[i] = 0; fprintf(stderr, "-- Warning: version string returned by server is incorrect.\n"); return; } safe_server_info[i] = server_info[i]; } safe_server_info[safe_server_info_len - 1] = 0; }
/* Copyright Abandoned 1996,1999 TCX DataKonsult AB & Monty Program KB & Detron HB, 1996, 1999-2004, 2007 MySQL AB. This file is public domain and comes with NO WARRANTY of any kind */
-- MySQL dump 10.13 Distrib 8.0.0-injection-test \! gnome-calculator, for Linux (x86_64) -- -- Host: 127.0.0.1 Database: mysql -- ------------------------------------------------------ -- Server version 8.0.0-injection-test \! gnome-calculator
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!50503 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;