char *p;
p = strchr(buf+19,':');
- h->NumCopies = atoi(p+1);
+ if (p) {
+ h->NumCopies = atoi(p+1);
+ }
} else if (strncmp(buf,"%%PDFTOPDFCollate",17) == 0) {
char *p;
p = strchr(buf+17,':');
- while (*p == ' ' || *p == '\t') p++;
- if (strncasecmp(p,"true",4) == 0) {
- h->Collate = CUPS_TRUE;
- } else {
- h->Collate = CUPS_FALSE;
+ if (p) {
+ p++;
+ while (*p == ' ' || *p == '\t') p++;
+ if (strncasecmp(p,"true",4) == 0) {
+ h->Collate = CUPS_TRUE;
+ } else {
+ h->Collate = CUPS_FALSE;
+ }
}
}
}
char *p;
p = strchr(buf+19,':');
- h->NumCopies = atoi(p+1);
+ if (p) {
+ h->NumCopies = atoi(p+1);
+ }
} else if (strncmp(buf,"%%PDFTOPDFCollate",17) == 0) {
char *p;
p = strchr(buf+17,':');
- while (*p == ' ' || *p == '\t') p++;
- if (strncasecmp(p,"true",4) == 0) {
- h->Collate = CUPS_TRUE;
- } else {
- h->Collate = CUPS_FALSE;
+ if (p) {
+ p++;
+ while (*p == ' ' || *p == '\t') p++;
+ if (strncasecmp(p,"true",4) == 0) {
+ h->Collate = CUPS_TRUE;
+ } else {
+ h->Collate = CUPS_FALSE;
+ }
}
}
}
if (strncmp(buf,"%%PDFTOPDFNumCopies",19) == 0) {
char *p;
- p = strchr(buf+19,':') + 1;
- while (*p == ' ' || *p == '\t') p++;
- strncpy(deviceCopies, p, sizeof(deviceCopies));
- deviceCopies[sizeof(deviceCopies) - 1] = '\0';
- p = deviceCopies + strlen(deviceCopies) - 1;
- while (*p == ' ' || *p == '\t' || *p == '\r' || *p == '\n') p--;
- *(p + 1) = '\0';
- pdftopdfapplied = 1;
+ p = strchr(buf+19,':');
+ if (p) {
+ p++;
+ while (*p == ' ' || *p == '\t') p++;
+ strncpy(deviceCopies, p, sizeof(deviceCopies));
+ deviceCopies[sizeof(deviceCopies) - 1] = '\0';
+ p = deviceCopies + strlen(deviceCopies) - 1;
+ while (*p == ' ' || *p == '\t' || *p == '\r' || *p == '\n') p--;
+ *(p + 1) = '\0';
+ pdftopdfapplied = 1;
+ }
} else if (strncmp(buf,"%%PDFTOPDFCollate",17) == 0) {
char *p;
- p = strchr(buf+17,':') + 1;
- while (*p == ' ' || *p == '\t') p++;
- if (strncasecmp(p,"true",4) == 0) {
- deviceCollate = 1;
- } else {
- deviceCollate = 0;
+ p = strchr(buf+17,':');
+ if (p) {
+ p++;
+ while (*p == ' ' || *p == '\t') p++;
+ if (strncasecmp(p,"true",4) == 0) {
+ deviceCollate = 1;
+ } else {
+ deviceCollate = 0;
+ }
+ pdftopdfapplied = 1;
}
- pdftopdfapplied = 1;
} else if (strcmp(buf,"% This file was generated by pdftopdf") == 0) {
pdftopdfapplied = 1;
}
char *p;
p = strchr(buf+19,':');
- deviceCopies = atoi(p+1);
+ if (p) {
+ deviceCopies = atoi(p+1);
+ }
} else if (strncmp(buf,"%%PDFTOPDFCollate",17) == 0) {
char *p;
p = strchr(buf+17,':');
- while (*p == ' ' || *p == '\t') p++;
- if (strncasecmp(p,"true",4) == 0) {
- deviceCollate = true;
- } else {
- deviceCollate = false;
+ if (p) {
+ p++;
+ while (*p == ' ' || *p == '\t') p++;
+ if (strncasecmp(p,"true",4) == 0) {
+ deviceCollate = true;
+ } else {
+ deviceCollate = false;
+ }
}
}
}