Date: Mon, 30 Jul 2001 04:18:03 -0700 (PDT) From: Alexander Trapeznikov <infoteacher@ipform.ru> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/29325: Dbview contains an error, because of which at review dbf files with text boxes which length of 255 characters , the program crashed. Message-ID: <200107301118.f6UBI3c64858@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 29325 >Category: ports >Synopsis: Dbview contains an error, because of which at review dbf files with text boxes which length of 255 characters , the program crashed. >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jul 30 04:20:04 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Alexander Trapeznikov >Release: FreeBSD 4.3 STABLE >Organization: IPFORM >Environment: FreeBSD wp4.ipform.ru 4.3-STABLE FreeBSD 4.3-STABLE #10: Tue Jun 26 14:38:27 MSD 2001 root@wp4.ipform.ru:/usr/obj/usr/src/sys/THIS i386 >Description: Current version dbview (1.0.3) contains an error, because of which at review dbf files with text boxes which length of 255 characters, the program crashed. As value FF becomes-1, and should be 255. >How-To-Repeat: Patch for db_dump.c: Index: db_dump.c =================================================================== RCS file: /usr/local/cvsroot/dbview/src/db_dump.c,v retrieving revision 1.1 retrieving revision 2.0 diff -r1.1 -r2.0 57c57 < #include <malloc.h> --- > #include <stdlib.h> 166a167,170 > int len; > char *info; > char *lang; > char *cdx; 174c178 < if( !(dbhead.version==3 || dbhead.version==0x83) ) { --- > if ( ! ( dbhead.version==0x03 || dbhead.version==0x83 || dbhead.version==0x04 || dbhead.version==0x05 || dbhead.version==0x8b || dbhead.version==0xf5 ) ) { 176,177c180,181 < if(dbhead.version==0x8b ) { < printf ("dBase IV - partially known...\n"); --- > if (dbhead.version==0x8e ) { > printf ("dBase IV or dBase V with SQL table - partially known...\n"); 178a183,185 > if (dbhead.version==0x43 || dbhead.version==0xb3){ > printf ("FlagShip - partially known...\n"); > } 180a188,207 > if (dbhead.version==0x03){ > info="Plain dbf, dBaseIII+"; > } > if (dbhead.version==0x04){ > info="Plain dbf, dBaseIV+"; > } > if (dbhead.version==0x05){ > info="Plain dbf, dBaseV or FoxPro"; > } > if (dbhead.version==0x83){ > info="dBaseIII+ w/memo"; > } > if (dbhead.version==0x8b){ > info="dBaseIV+ w/memo"; > } > if (dbhead.version==0xf5){ > info="FoxPro w/memo"; > } > > fields=(dbhead.header-1)/32-1; 181a209,229 > if (dbhead.excdx){ > cdx="Yes"; > } > else{ > cdx="No"; > } > if (dbhead.language==101){ > lang="DOS 866"; > } > else if (dbhead.language==2){ > lang="WIN 1251"; > } > else if (dbhead.language==2){ > lang="DOS 850 Multi ling"; > } > else if (dbhead.language==1){ > lang="DOS 437 USA"; > } > else{ > lang="Unknow"; > } 183,187c231,238 < printf("File version : %d\n",dbhead.version); < printf("Last update : %02d/%02d/%2d\n", dbhead.l_update[1],dbhead.l_update[2],dbhead.l_update[0]); < printf("Number of recs: %ld\n",dbhead.count); < printf("Header length : %d\n",dbhead.header); < printf("Record length : %d\n",dbhead.lrecl); --- > printf("File version : %d, %s\n",dbhead.version,info); > printf("Last update : %02d/%02d/%2d\n", dbhead.l_update[1],dbhead.l_update[2],dbhead.l_update[0]+1900); > printf("Number of recs : %ld\n",dbhead.count); > printf("Header length : %d\n",dbhead.header); > printf("Record length : %d\n",dbhead.lrecl); > printf("Exist index cdx : %s\n",cdx); > printf("Language ID : %s\n",lang); > printf("Count fields : %d\n\n",fields); 191,193c242 < < fields=(dbhead.header-1)/32-1; < --- > 206a256,261 > if (fld->length==-1){ > len=fld->length+256; > } > else{ > len=fld->length; > } 208c263 < fld->length,fld->dec_point); --- > len,fld->dec_point); 230c285 < --- > lseek(dbfile,dbhead.header,SEEK_SET); 256c311,312 < --- > int len; > 259,260c315,322 < memcpy(buf_work,temp->data,temp->fld->length); < buf_work[temp->fld->length] = '\0'; --- > if (temp->fld->length==-1){ > len=temp->fld->length+256; > } > else{ > len=temp->fld->length; > } > memcpy(buf_work,temp->data,len); > buf_work[len] = '\0'; Patch for db_dump.h: Index: db_dump.h =================================================================== RCS file: /usr/local/cvsroot/dbview/src/db_dump.h,v retrieving revision 1.1 retrieving revision 2.0 diff -r1.1 -r2.0 51c51,54 < unsigned char version; /* 03 for dbIII and 83 for dbIII w/memo file */ --- > unsigned char version; /* 0x03,0x04,0x05-DBIII+/DBIV */ > /* 0x83 - DBIII+ w/memo;*/ > /* 0xF5-FoxPro w/memo;*/ > /* 0x8B-DBIV w/memo file */ 61c64,67 < unsigned char reserv[20]; --- > unsigned char reserv1[16]; > unsigned char excdx; /* 1-exist cdx file, 0 - nonexist*/ > unsigned char language; /* language driver:0x01 - 437 DOS;0x02 - 850 DOS; 0x03 - 1251; 0x00 - ignored*/ > unsigned char reserv2[2]; 63,68c69,82 < < #define DB_FLD_CHAR 'C' < #define DB_FLD_NUM 'N' < #define DB_FLD_LOGIC 'L' < #define DB_FLD_MEMO 'M' < #define DB_FLD_DATE 'D' --- > > #define DB_FLD_CHAR 'C' > #define DB_FLD_NUM 'N' > #define DB_FLD_LOGIC 'L' > #define DB_FLD_VARIABLE 'V' > #define DB_FLD_MEMO 'M' > #define DB_FLD_FLOAT 'F' > #define DB_FLD_PICTURE 'P' > #define DB_FLD_BINARY 'B' > #define DB_FLD_GENERAL 'G' > #define DB_FLD_SHINT '2' > #define DB_FLD_LINT '4' > #define DB_FLD_DOUBLE '8' > #define DB_FLD_DATE 'D' Patch for dbview.c: Index: dbview.c =================================================================== RCS file: /usr/local/cvsroot/dbview/src/dbview.c,v retrieving revision 1.1 retrieving revision 2.0 diff -r1.1 -r2.0 37c37 < printf ("%s %s - %s, (c) 1996 by Martin Schulze\n", progname, version, longname); --- > printf ("%s %s - %s, (c) 1996 by Martin Schulze, Patched Alexander Trapeznikov, 2001 \n", progname, version, longname); 44c44 < printf ("%s %s - %s, (c) 1996 by Martin Schulze\n", progname, version, longname); --- > printf ("%s %s - %s, (c) 1996 by Martin Schulze, Patched Alexander Trapeznikov, 2001 \n", progname, version, longname); 57c57 < void main (int argc, char **argv) --- > int main (int argc, char **argv) 84a85 > /* printf ("DB_FL_BROWSE\n"); */ 93a95 > /* printf ("DB_FL_DESCR\n"); */ 99a102 > /* printf ("DB_FL_INFO\n"); */ 102a106 > /* printf ("DB_FL_OMIT\n"); */ 105a110 > /* printf ("DB_FL_RESERVE\n"); */ 108a114 > /* printf ("DB_FL_TRIM\n"); */ Patch for version.c: Index: version.c =================================================================== RCS file: /usr/local/cvsroot/dbview/src/version.c,v retrieving revision 1.1 retrieving revision 2.0 diff -r1.1 -r2.0 24c24 < char longname[] = "View dBase III files"; --- > char longname[] = "View dbf files"; 26c26 < char version[] = "1.0.2"; --- > char version[] = "1.0.3.1"; >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200107301118.f6UBI3c64858>