Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.5:Update
termcap
termcap-2.0.8-setuid.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File termcap-2.0.8-setuid.patch of Package termcap
Index: termcap-2.0.8/termcap.c =================================================================== --- termcap-2.0.8.orig/termcap.c +++ termcap-2.0.8/termcap.c @@ -21,6 +21,7 @@ #include <stdlib.h> #include <unistd.h> #include <malloc.h> +#include <sys/fsuid.h> #include <string.h> #include <sys/ioctl.h> #include <termios.h> @@ -342,13 +343,17 @@ static char *tc_read(struct tc_ent **tcp struct tc_ent *l = NULL; int first = 1; int loop = 0; + int tc_set = 0; *tcp = NULL; /* See if we have a TERMCAP environment variable. */ if ((tc = getenv("TERMCAP")) != NULL) { if (*tc == '/') + { tc_file = tc; + tc_set=1; + } else { /* check if TERMCAP is term */ if (tc_comp(tc, term)) { @@ -369,8 +374,28 @@ static char *tc_read(struct tc_ent **tcp printf("Using file %s\n", tc_file); #endif + if(tc_set) + { + if (-1 == setfsuid(getuid())) { + perror("setfsuid"); + return NULL; + } + if (-1 == setfsgid(getgid())) { + setfsuid(geteuid()); + perror("setfsgid"); + return NULL; + } + } /* Now read the termcap file. */ - if ((fp = fopen(tc_file, "r")) == NULL) return(NULL); + fp = fopen(tc_file, "r"); + + if(tc_set) + { + setfsuid(geteuid()); + setfsgid(getegid()); + } + if (fp == NULL) + return(NULL); while(term) { if (++loop > 16) {
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