]> git.pld-linux.org Git - packages/at.git/blob - at-env-tng.patch
- massive attack s/pld.org.pl/pld-linux.org/
[packages/at.git] / at-env-tng.patch
1 --- at-3.1.8/at.c.env   Fri Jul 20 01:37:01 2001
2 +++ at-3.1.8/at.c       Fri Jul 20 01:43:58 2001
3 @@ -357,24 +357,27 @@
4       */
5      for (atenv = environ; *atenv != NULL; atenv++) {
6         int export = 1;
7 -       char *eqp;
8 +       char *pch;
9 +       char * eqp = *atenv;
10 +       char * valp = *atenv;
11  
12 -       eqp = strchr(*atenv, '=');
13 -       if (ap == NULL)
14 -           eqp = *atenv;
15 -       else {
16 +       if ((pch = strchr(*atenv, '=')) != 0) {
17             unsigned int i;
18 +
19 +            eqp = pch;
20 +            valp = pch + 1;
21             for (i = 0; i < sizeof(no_export) / sizeof(no_export[0]); i++) {
22                 export = export
23                     && (strncmp(*atenv, no_export[i],
24                                 (size_t) (eqp - *atenv)) != 0);
25             }
26 -           eqp++;
27 -       }
28 +       } else {
29 +            continue; /* no '=', so bail on this one */
30 +        }
31  
32         if (export) {
33 -           fwrite(*atenv, sizeof(char), eqp - *atenv, fp);
34 -           for (ap = eqp; *ap != '\0'; ap++) {
35 +           fwrite(*atenv, sizeof(char), valp - *atenv, fp);
36 +           for (ap = valp; *ap != '\0'; ap++) {
37                 if (*ap == '\n')
38                     fprintf(fp, "\"\n\"");
39                 else {
40 @@ -405,7 +408,7 @@
41                 }
42             }
43             fputs("; export ", fp);
44 -           fwrite(*atenv, sizeof(char), eqp - *atenv - 1, fp);
45 +           fwrite(*atenv, sizeof(char), eqp - *atenv, fp);
46             fputc('\n', fp);
47  
48         }
This page took 0.035941 seconds and 3 git commands to generate.