View | Details | Raw Unified | Return to bug 201243
Collapse All | Expand All

(-)usr.bin/locate/bigram/locate.bigram.c (working copy) (-3 / +3 lines)
Lines 59-69 Link Here
59
#include <stdio.h>
59
#include <stdio.h>
60
#include <stdlib.h>
60
#include <stdlib.h>
61
#include <sys/param.h>                 /* for MAXPATHLEN */
61
#include <sys/param.h>
62
#include "locate.h"
62
#include "locate.h"
63
u_char buf1[MAXPATHLEN] = " ";
63
u_char buf1[LOCPATHLEN] = " ";
64
u_char buf2[MAXPATHLEN];
64
u_char buf2[LOCPATHLEN];
65
u_int bigram[UCHAR_MAX + 1][UCHAR_MAX + 1];
65
u_int bigram[UCHAR_MAX + 1][UCHAR_MAX + 1];
66
int
66
int
(-)usr.bin/locate/code/locate.code.c (working copy) (-2 / +2 lines)
Lines 104-111 Link Here
104
#define        BGBUFSIZE       (NBG * 2)       /* size of bigram buffer */
104
#define        BGBUFSIZE       (NBG * 2)       /* size of bigram buffer */
105
u_char buf1[MAXPATHLEN] = " ";
105
u_char buf1[LOCPATHLEN] = " ";
106
u_char buf2[MAXPATHLEN];
106
u_char buf2[LOCPATHLEN];
107
u_char bigrams[BGBUFSIZE + 1] = { 0 };
107
u_char bigrams[BGBUFSIZE + 1] = { 0 };
108
#define LOOKUP 1 /* use a lookup array instead a function, 3x faster */
108
#define LOOKUP 1 /* use a lookup array instead a function, 3x faster */
(-)usr.bin/locate/locate/fastfind.c (working copy) (-3 / +3 lines)
Lines 50-56 Link Here
50
       register u_char *p, *s;
50
       register u_char *p, *s;
51
       register int c;
51
       register int c;
52
       int count, umlaut;
52
       int count, umlaut;
53
       u_char bigram1[NBG], bigram2[NBG], path[MAXPATHLEN];
53
       u_char bigram1[NBG], bigram2[NBG], path[LOCPATHLEN];
54
       for (c = 0, p = bigram1, s = bigram2; c < NBG; c++) {
54
       for (c = 0, p = bigram1, s = bigram2; c < NBG; c++) {
55
               p[c] = check_bigram_char(getc(fp));
55
               p[c] = check_bigram_char(getc(fp));
Lines 143-149 Link Here
143
       register int c, cc;
143
       register int c, cc;
144
       int count, found, globflag;
144
       int count, found, globflag;
145
       u_char *cutoff;
145
       u_char *cutoff;
146
       u_char bigram1[NBG], bigram2[NBG], path[MAXPATHLEN];
146
       u_char bigram1[NBG], bigram2[NBG], path[LOCPATHLEN];
147
#ifdef FF_ICASE
147
#ifdef FF_ICASE
148
       /* use a lookup table for case insensitive search */
148
       /* use a lookup table for case insensitive search */
Lines 213-219 Link Here
213
                       count += c - OFFSET;
213
                       count += c - OFFSET;
214
               }
214
               }
215
               if (count < 0 || count > MAXPATHLEN)
215
               if (count < 0 || count > LOCPATHLEN)
216
                       errx(1, "corrupted database: %s", database);
216
                       errx(1, "corrupted database: %s", database);
217
               /* overlay old path */
217
               /* overlay old path */
218
               p = path + count;
218
               p = path + count;
(-)usr.bin/locate/locate/locate.h (working copy) (+2 lines)
Lines 70-72 Link Here
70
#define INTSIZE (sizeof(int))
70
#define INTSIZE (sizeof(int))
71
#define LOCATE_REG "*?[]\\"  /* fnmatch(3) meta characters */
71
#define LOCATE_REG "*?[]\\"  /* fnmatch(3) meta characters */
72
73
#define LOCPATHLEN 2048
(-)usr.bin/locate/locate/util.c (working copy) (-8 / +8 lines)
Lines 242-252 Link Here
242
       i = u.i;
242
       i = u.i;
243
       if (i > MAXPATHLEN || i < -(MAXPATHLEN)) {
243
       if (i > LOCPATHLEN || i < -(LOCPATHLEN)) {
244
               hi = ntohl(i);
244
               hi = ntohl(i);
245
               if (hi > MAXPATHLEN || hi < -(MAXPATHLEN))
245
               if (hi > LOCPATHLEN || hi < -(LOCPATHLEN))
246
                       errx(1, "integer out of +-MAXPATHLEN (%d): %u",
246
                       errx(1, "integer out of +-LOCPATHLEN (%d): %u",
247
                           MAXPATHLEN, abs(i) < abs(hi) ? i : hi);
247
                           LOCPATHLEN, abs(i) < abs(hi) ? i : hi);
248
               return(hi);
248
               return(hi);
249
       }
249
       }
250
       return(i);
250
       return(i);
Lines 268-278 Link Here
268
       word = getw(fp);
268
       word = getw(fp);
269
       if (word > MAXPATHLEN || word < -(MAXPATHLEN)) {
269
       if (word > LOCPATHLEN || word < -(LOCPATHLEN)) {
270
               hword = ntohl(word);
270
               hword = ntohl(word);
271
               if (hword > MAXPATHLEN || hword < -(MAXPATHLEN))
271
               if (hword > LOCPATHLEN || hword < -(LOCPATHLEN))
272
                       errx(1, "integer out of +-MAXPATHLEN (%d): %u",
272
                       errx(1, "integer out of +-LOCPATHLEN (%d): %u",
273
                           MAXPATHLEN, abs(word) < abs(hword) ? word : hword);
273
                           LOCPATHLEN, abs(word) < abs(hword) ? word : hword);
274
               return(hword);
274
               return(hword);
275
       }
275
       }
276
       return(word);
276
       return(word);

Return to bug 201243