1 --- cxhextris/xio.c.old Sat May 2 19:53:23 1998
2 +++ cxhextris/xio.c Sat May 2 19:53:51 1998
5 log_name = pwent->pw_name;
8 for (i = 1; i < argc; i++) {
9 if (! strcmp(argv[i],"-rv")) {
11 --- cxhextris/stdsys.c.old Wed Apr 7 03:21:20 1993
12 +++ cxhextris/stdsys.c Sat May 2 19:53:00 1998
14 npiece->column = MAXCOLUMN / 2;
19 + * Added by Alan Cox , RedHat May 1997
21 + * Xhextris isnt the cleanest of code, its also using a ton of toolkits. I've
22 + * swatted the bug reported by Chris Evans but I don't believe that this is the
25 + * So we do it this way.
27 + * main calls init_scoreboard(). init_scoreboard drops all setuid/setgidness
28 + * _after_ opening up the scoreboard.
31 +static FILE *scores=NULL;
33 +void init_scoreboard(void)
35 + scores=fopen(HIGHSCOREFILE, "r+");
37 + if(setregid(getgid(),getgid())==-1 ||
38 + setreuid(getuid(),getuid())==-1)
40 + perror("drop privileges");
45 +static FILE *get_score_file(void)
53 +static void put_score_file(void)
58 /* This reads in the high score file.
60 read_high_scores(high_scores)
64 FILE *high_score_file;
65 - char high_score_file_name[512];
68 - strcpy(high_score_file_name,HIGHSCOREFILE);
70 - if ((high_score_file = fopen(high_score_file_name , "r")) == NULL) {
71 + if ((high_score_file = get_score_file()) == NULL) {
72 fprintf(stderr,"xhextris: Can't open high score file.\n");
76 high_scores[j].score = 0;
77 high_scores[j].rows = 0;
79 - fclose(high_score_file);
85 char high_score_file_name[512];
88 - strcpy(high_score_file_name,HIGHSCOREFILE);
93 - if ((high_score_file = fopen(high_score_file_name, "w")) == NULL) {
94 + if ((high_score_file = get_score_file()) == NULL) {
95 fprintf(stderr,"xhextris: Can't open high score file.\n");
99 fwrite(buffer,sizeof(char),40,high_score_file);
101 fflush(high_score_file);
102 - fclose(high_score_file);
104 /* rename(tmp_high_score_file_name,high_score_file_name);*/
107 --- cxhextris/hextris.c.old Tue Apr 6 00:55:55 1993
108 +++ cxhextris/hextris.c Sat May 2 19:57:36 1998
110 high_scores[j].score = high_scores[j-1].score;
111 high_scores[j].rows = high_scores[j-1].rows;
113 - strcpy(high_scores[i].name, name);
114 - strcpy(high_scores[i].userid, userid);
115 + strncpy(high_scores[i].name, name, sizeof(high_scores[i].name));
116 + strncpy(high_scores[i].userid, userid, sizeof(high_scores[i].userid));
117 high_scores[i].score = score;
118 high_scores[i].rows = rows;