reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit 73534ade0dbf10568935a636c8ab530dc15011f3
parent 32a1aa6b4fd2cc31787c1ecd4026f491b4a5284f
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Tue,  8 Dec 2015 22:54:02 -0500

validate .ReaPackRemote files before importing them

Diffstat:
Msrc/reapack.cpp | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/reapack.cpp b/src/reapack.cpp @@ -8,6 +8,7 @@ #include <reaper_plugin_functions.h> #include <fstream> +#include <regex> using namespace std; @@ -108,6 +109,16 @@ void ReaPack::importRemote() file.close(); + static const regex namePattern("^[\\w\\s]+$"); + + smatch nameMatch; + regex_match(name, nameMatch, namePattern); + + if(nameMatch.empty() || url.empty()) { + ShowMessageBox("Invalid .ReaPackRemote file!", title, 0); + return; + } + if(m_config->remotes().count({name})) { ShowMessageBox("This remote is already configured.", title, 0); return;