Changeset 2322


Ignore:
Timestamp:
Jan 18, 2019, 4:18:49 PM (6 years ago)
Author:
Yuri Dario
Message:

Fix parsing of whitespace only lines in cron2.dat.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified cron2/trunk/src/cron2.c

    r2321 r2322  
    835835    PROCESS *theProc;
    836836
    837     if((theProc = (PROCESS *)malloc(sizeof(PROCESS))) == NULL)
     837    if((theProc = (PROCESS *)calloc(1,sizeof(PROCESS))) == NULL)
    838838    {
    839839        log("Memory allocation failure in parse_line()\n");
     
    847847
    848848    x = 0;
    849     token = strtok(line," ");
     849    token = strtok(line," \t");
     850
     851    // check for empty line
     852    if (token == NULL) {
     853        printf("ERROR: invalid characters in line %d of CRON2.DAT\n",ln);
     854        log("ERROR: invalid characters in line %d of CRON2.DAT\n",ln);
     855        c2errno = BAD_CRON2_ENTRY;
     856        free(theProc->origline);
     857        free(theProc);
     858        return(NULL);
     859    }
    850860
    851861    while(token)
     
    16351645        }
    16361646
    1637         token = strtok(NULL," ");
     1647        token = strtok(NULL," \t");
    16381648    }
    16391649
Note: See TracChangeset for help on using the changeset viewer.