Fossil

Check-in [6e7e8fbe]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a possible NULL-pointer dereference in the "fossil search" command.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | branch-1.28
Files: files | file ages | folders
SHA1:6e7e8fbe019425134e69ee7a47e68f5ee85783a2
User & Date: drh 2014-01-09 21:00:38
Context
2014-01-09
21:12
Add -width option to the search command. check-in: 1f10199a user: mistachkin tags: branch-1.28
21:00
Fix a possible NULL-pointer dereference in the "fossil search" command. check-in: 6e7e8fbe user: drh tags: branch-1.28
20:59
Fix a possible NULL-pointer dereference in the "fossil search" command. check-in: 5dc60b1f user: drh tags: trunk
20:25
Avoid initializing TH1 for running hooks when not strictly necessary. check-in: 211ddf89 user: mistachkin tags: branch-1.28
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/search.c.

104
105
106
107
108
109
110

111
112
113
114
115
116
117
  int iPrev = 999;
  int score = 10;
  int iBonus = 0;
  int i, j;
  unsigned char seen[8];

  memset(seen, 0, sizeof(seen));

  for(i=0; zDoc[i]; i++){
    char c = zDoc[i];
    if( isBoundary[c&0xff] ) continue;
    for(j=0; j<p->nTerm; j++){
      int n = p->a[j].n;
      if( sqlite3_strnicmp(p->a[j].z, &zDoc[i], n)==0 ){
        score += 1;







>







104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
  int iPrev = 999;
  int score = 10;
  int iBonus = 0;
  int i, j;
  unsigned char seen[8];

  memset(seen, 0, sizeof(seen));
  if( zDoc==0 ) return score;
  for(i=0; zDoc[i]; i++){
    char c = zDoc[i];
    if( isBoundary[c&0xff] ) continue;
    for(j=0; j<p->nTerm; j++){
      int n = p->a[j].n;
      if( sqlite3_strnicmp(p->a[j].z, &zDoc[i], n)==0 ){
        score += 1;