summaryrefslogtreecommitdiff
path: root/source3/printing/printing.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-08-31 03:11:42 +0000
committerAndrew Tridgell <tridge@samba.org>1998-08-31 03:11:42 +0000
commit61b5fd6f32e9ccb612df1354a3e3b3bed5f2b808 (patch)
tree06d72234112a52e30d5b72e367e42efc43e9762f /source3/printing/printing.c
parentab4577f141b0c08a543d998a36892bbafae4e902 (diff)
downloadsamba-61b5fd6f32e9ccb612df1354a3e3b3bed5f2b808.tar.gz
samba-61b5fd6f32e9ccb612df1354a3e3b3bed5f2b808.tar.bz2
samba-61b5fd6f32e9ccb612df1354a3e3b3bed5f2b808.zip
bounds check next_token() to prevent possible buffer overflows
(This used to be commit 3eade55dc7c842bdc50205c330802d211fae54d3)
Diffstat (limited to 'source3/printing/printing.c')
-rw-r--r--source3/printing/printing.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 2c7197f9db..fae4c1cc05 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -228,7 +228,10 @@ static BOOL parse_lpq_bsd(char *line,print_queue_struct *buf,BOOL first)
string_sub(line,"(","\"");
string_sub(line,")","\"");
- for (count=0; count<NTOK && next_token(&line,tok[count],NULL); count++) ;
+ for (count=0;
+ count<NTOK &&
+ next_token(&line,tok[count],NULL, sizeof(tok[count]));
+ count++) ;
/* we must get NTOK tokens */
if (count < NTOK)
@@ -398,7 +401,10 @@ A long spool-path will just waste significant chars of the file name.
string_sub(line,"(","\"");
string_sub(line,")","\"");
- for (count=0; count<LPRNG_NTOK && next_token(&line,tok[count],NULL); count++) ;
+ for (count=0;
+ count<LPRNG_NTOK &&
+ next_token(&line,tok[count],NULL, sizeof(tok[count]));
+ count++) ;
/* we must get LPRNG_NTOK tokens */
if (count < LPRNG_NTOK)
@@ -471,7 +477,10 @@ static BOOL parse_lpq_aix(char *line,print_queue_struct *buf,BOOL first)
string_sub(line,"(","\"");
string_sub(line,")","\"");
- for (count=0; count<10 && next_token(&line,tok[count],NULL); count++) ;
+ for (count=0;
+ count<10 &&
+ next_token(&line,tok[count],NULL, sizeof(tok[count]));
+ count++) ;
/* we must get 6 tokens */
if (count < 10)
@@ -585,7 +594,7 @@ static BOOL parse_lpq_hpux(char * line, print_queue_struct *buf, BOOL first)
string_sub(line,"(","\"");
string_sub(line,")","\"");
- for (count=0; count<2 && next_token(&line,tok[count],NULL); count++) ;
+ for (count=0; count<2 && next_token(&line,tok[count],NULL,sizeof(tok[count])); count++) ;
/* we must get 2 tokens */
if (count < 2) return(False);
@@ -621,7 +630,7 @@ static BOOL parse_lpq_hpux(char * line, print_queue_struct *buf, BOOL first)
/* handle the dash in the job id */
string_sub(line,"-"," ");
- for (count=0; count<12 && next_token(&line,tok[count],NULL); count++) ;
+ for (count=0; count<12 && next_token(&line,tok[count],NULL,sizeof(tok[count])); count++) ;
/* we must get 8 tokens */
if (count < 8) return(False);
@@ -671,7 +680,7 @@ static BOOL parse_lpq_sysv(char *line,print_queue_struct *buf,BOOL first)
/* handle the dash in the job id */
string_sub(line,"-"," ");
- for (count=0; count<9 && next_token(&line,tok[count],NULL); count++) ;
+ for (count=0; count<9 && next_token(&line,tok[count],NULL,sizeof(tok[count])); count++) ;
/* we must get 7 tokens */
if (count < 7)
@@ -735,7 +744,7 @@ static BOOL parse_lpq_qnx(char *line,print_queue_struct *buf,BOOL first)
- for (count=0; count<7 && next_token(&line,tok[count],NULL); count++) ;
+ for (count=0; count<7 && next_token(&line,tok[count],NULL,sizeof(tok[count])); count++) ;
/* we must get 7 tokens */
if (count < 7)
@@ -790,7 +799,7 @@ static BOOL parse_lpq_plp(char *line,print_queue_struct *buf,BOOL first)
string_sub(line,"(","\"");
string_sub(line,")","\"");
- for (count=0; count<11 && next_token(&line,tok[count],NULL); count++) ;
+ for (count=0; count<11 && next_token(&line,tok[count],NULL,sizeof(tok[count])); count++) ;
/* we must get 11 tokens */
if (count < 11)
@@ -858,7 +867,7 @@ static BOOL parse_lpq_softq(char *line,print_queue_struct *buf,BOOL first)
/* mung all the ":"s to spaces*/
string_sub(line,":"," ");
- for (count=0; count<10 && next_token(&line,tok[count],NULL); count++) ;
+ for (count=0; count<10 && next_token(&line,tok[count],NULL,sizeof(tok[count])); count++) ;
/* we must get 9 tokens */
if (count < 9)