Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Backports:SLE-15-SP5:Update
amanda.18010
amanda-CVE-2023-30577.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File amanda-CVE-2023-30577.patch of Package amanda.18010
Index: amanda-tag-community-3.5.2/client-src/runtar.c =================================================================== --- amanda-tag-community-3.5.2.orig/client-src/runtar.c +++ amanda-tag-community-3.5.2/client-src/runtar.c @@ -39,6 +39,11 @@ #include "amutil.h" #include "conffile.h" #include "client_util.h" +#include <stdbool.h> + +static const char *whitelisted_args[] = {"--blocking-factor", "--file", "--directory", "--exclude", "--transform", "--listed-incremental", "--newer", "--exclude-from", "--files-from", NULL}; + +bool check_whitelist(char* option); int main(int argc, char **argv); @@ -49,6 +54,7 @@ main( { #ifdef GNUTAR int i; + char **j; char *e; char *dbf; char *cmdline; @@ -182,17 +188,24 @@ main( g_str_has_prefix(argv[i],"--verbose")) { /* Accept theses options */ good_option++; - } else if (g_str_has_prefix(argv[i],"--blocking-factor") || - g_str_has_prefix(argv[i],"--file") || - g_str_has_prefix(argv[i],"--directory") || - g_str_has_prefix(argv[i],"--exclude") || - g_str_has_prefix(argv[i],"--transform") || - g_str_has_prefix(argv[i],"--listed-incremental") || - g_str_has_prefix(argv[i],"--newer") || - g_str_has_prefix(argv[i],"--exclude-from") || - g_str_has_prefix(argv[i],"--files-from")) { - /* Accept theses options with the following argument */ - good_option += 2; + } else if (check_whitelist(argv[i])) { + if (strchr(argv[i], '=')) { + good_option++; + } else { + /* Accept theses options with the following argument */ + good_option += 2; + + /* Whitelisting only the allowed arguments*/ + for(j=whitelisted_args; *j; j++) { + if (strcmp(argv[i], *j) == 0) { + break; + } + } + + if (!*j) { + good_option = 0; // not allowing arguments absent in the whitelist + } + } } else if (argv[i][0] != '-') { good_option++; } @@ -223,6 +236,7 @@ main( env = safe_env(); execve(my_realpath, new_argv, env); free_env(env); + free_env(new_argv); e = strerror(errno); dbreopen(dbf, "more"); @@ -235,3 +249,23 @@ main( return 1; #endif } + +bool +check_whitelist( + gchar* option) +{ + bool result = TRUE; + char** i; + + for(i=whitelisted_args; *i; i++) { + if (g_str_has_prefix(option, *i)) { + break; + } + } + + if (!*i) { + result = FALSE; // not allowing arguments absent in the whitelist + } + + return result; +}
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor