a few security fixes

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@219 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Joshua Kwan 2004-02-02 23:28:17 +00:00
parent f0efefec2f
commit 39100e0631
2 changed files with 7 additions and 7 deletions

View File

@ -866,7 +866,7 @@ loginprompt (int from_ttyplay)
void void
newuser () newuser ()
{ {
char buf[1024]; char buf[1024], dirname[100];
int error = 2; int error = 2;
unsigned int i; unsigned int i;
@ -984,6 +984,11 @@ newuser ()
snprintf (rcfilename, 80, "%srcfiles/%s.nethackrc", myconfig->dglroot, me->username); snprintf (rcfilename, 80, "%srcfiles/%s.nethackrc", myconfig->dglroot, me->username);
write_canned_rcfile (rcfilename); write_canned_rcfile (rcfilename);
/* create their ttyrec dir */
snprintf (dirname, 100, "%sttyrec/%s", myconfig->dglroot, me->username);
if (access (dirname, F_OK) != 0)
mkdir (dirname, 0755);
writefile (1); writefile (1);
} }
@ -1480,7 +1485,7 @@ main (int argc, char** argv)
unsigned int len; unsigned int len;
int c; int c;
while ((c = getopt(argc, argv, "qh:p:f:")) != -1) while ((c = getopt(argc, argv, "qh:pp:f:")) != -1)
{ {
switch (c) switch (c)
{ {

View File

@ -86,11 +86,6 @@ ttyrec_main (char *username, char* ttyrec_filename)
{ {
char dirname[100]; char dirname[100];
snprintf (dirname, 100, "%sttyrec/%s", myconfig->dglroot, username);
if (access (dirname, F_OK) != 0)
mkdir (dirname, 0755);
snprintf (dirname, 100, "%sttyrec/%s/%s", myconfig->dglroot, username, snprintf (dirname, 100, "%sttyrec/%s/%s", myconfig->dglroot, username,
ttyrec_filename); ttyrec_filename);