diff options
-rw-r--r-- | source3/lib/util_file.c | 2 | ||||
-rw-r--r-- | source3/printing/nt_printing.c | 12 |
2 files changed, 8 insertions, 6 deletions
diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c index f3e2879587..c3b444ffa1 100644 --- a/source3/lib/util_file.c +++ b/source3/lib/util_file.c @@ -371,6 +371,8 @@ char *file_load(char *fname, size_t *size) int fd; SMB_STRUCT_STAT sbuf; char *p; + + if (!fname || !*fname) return NULL; fd = open(fname,O_RDONLY); if (fd == -1) return NULL; diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 7cb2e9aab5..44f228880a 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -42,7 +42,9 @@ static BOOL parse_form_entry(char *line, nt_forms_struct *buf) char *tok[MAXTOK]; int count = 0; - tok[count] = strtok(line,":"); + tok[0] = strtok(line,":"); + + if (!tok[0]) return False; /* strip the comment lines */ if (tok[0][0]=='#') return (False); @@ -53,7 +55,7 @@ static BOOL parse_form_entry(char *line, nt_forms_struct *buf) count++; } - DEBUG(106,("Found [%d] tokens\n", count)); + if (count < MAXTOK-1) return False; StrnCpy(buf->name,tok[NAMETOK],sizeof(buf->name)-1); buf->flag=atoi(tok[FLAGTOK]); @@ -83,11 +85,11 @@ int get_ntforms(nt_forms_struct **list) return(0); } + *list = NULL; + for (i=0; lines[i]; i++) { char *line = lines[i]; - DEBUG(105,("%s\n",line)); - *list = Realloc(*list, sizeof(nt_forms_struct)*(total+1)); if (! *list) { @@ -104,8 +106,6 @@ int get_ntforms(nt_forms_struct **list) file_lines_free(lines); - DEBUG(104,("%d info lines on %d\n",total, grandtotal)); - return(total); } |