From: Hans-Bernhard B. <br...@us...> - 2006-07-23 20:59:25
|
Update of /cvsroot/cscope/cscope/src In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv29812/src Modified Files: alloc.c build.c command.c constants.h crossref.c dir.c display.c find.c fscanner.l global.h history.c library.h main.c vpinit.c Added Files: alloc.h Log Message: Break out a new header: alloc.h Avoid buffer overflow by telling putstring about size of output buffer Rename stralloc -> my_strdup Rename putstring -> fetch_string_from_dbase Rename putinclude -> fetch_include_from_dbase --- NEW FILE --- /*=========================================================================== Copyright (c) 1998-2000, The Santa Cruz Operation All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: *Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. *Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. *Neither name of The Santa Cruz Operation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =========================================================================*/ /* $Id: alloc.h,v 1.1 2006/07/23 20:59:20 broeker Exp $ */ #ifndef CSCOPE_ALLOC_H #define CSCOPE_ALLOC_H #include <string.h> /* need size_t ... */ /* memory allocation support */ void *mycalloc(size_t nelem, size_t size); void *mymalloc(size_t size); void *myrealloc(void *p, size_t size); char *my_strdup(char *s); #endif /* CSCOPE_ALLOC_H */ Index: alloc.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/alloc.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** alloc.c 21 Apr 2006 10:45:48 -0000 1.7 --- alloc.c 23 Jul 2006 20:59:20 -0000 1.8 *************** *** 35,40 **** #include <stdio.h> #include <string.h> ! #include "library.h" ! #include "global.h" static char const rcsid[] = "$Id$"; --- 35,41 ---- #include <stdio.h> #include <string.h> ! #include "alloc.h" ! ! #include "global.h" /* for postfatal() */ static char const rcsid[] = "$Id$"; *************** *** 53,59 **** char * ! stralloc(char *s) { ! return(strcpy(mymalloc((int) strlen(s) + 1), s)); } --- 54,60 ---- char * ! my_strdup(char *s) { ! return(strcpy(mymalloc(strlen(s) + 1), s)); } Index: build.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/build.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** build.c 21 Apr 2006 10:45:48 -0000 1.10 --- build.c 23 Jul 2006 20:59:20 -0000 1.11 *************** *** 42,45 **** --- 42,46 ---- #include "library.h" + #include "alloc.h" #include "scanner.h" #include "version.h" /* for FILEVERSION */ *************** *** 88,92 **** static void movefile(char *new, char *old); static void putheader(char *dir); ! static void putinclude(char *s); static void putlist(char **names, int count); static BOOL samelist(FILE *oldrefs, char **names, int count); --- 89,93 ---- static void movefile(char *new, char *old); static void putheader(char *dir); ! static void fetch_include_from_dbase(char *, size_t); static void putlist(char **names, int count); static BOOL samelist(FILE *oldrefs, char **names, int count); *************** *** 147,155 **** ++s; strcpy(s, mybasename(reffile)); ! newreffile = stralloc(path); strcpy(s, mybasename(invname)); ! newinvname = stralloc(path); strcpy(s, mybasename(invpost)); ! newinvpost = stralloc(path); free(path); } --- 148,156 ---- ++s; strcpy(s, mybasename(reffile)); ! newreffile = my_strdup(path); strcpy(s, mybasename(invname)); ! newinvname = my_strdup(path); strcpy(s, mybasename(invpost)); ! newinvpost = my_strdup(path); free(path); } *************** *** 523,527 **** if (*blockp == NEWFILE) { skiprefchar(); ! putstring(file); if (file[0] != '\0') { /* if not end-of-crossref */ return(file); --- 524,528 ---- if (*blockp == NEWFILE) { skiprefchar(); ! fetch_string_from_dbase(file, sizeof(file)); if (file[0] != '\0') { /* if not end-of-crossref */ return(file); *************** *** 626,630 **** if (*cp == INCLUDE) { blockp = cp; ! putinclude(symbol); writestring(symbol); setmark('\t'); --- 627,631 ---- if (*cp == INCLUDE) { blockp = cp; ! fetch_include_from_dbase(symbol, sizeof(symbol)); writestring(symbol); setmark('\t'); *************** *** 678,687 **** return; case INCLUDE: /* #included file */ ! putinclude(symbol); goto output; } dbputc(type); skiprefchar(); ! putstring(symbol); goto output; } --- 679,688 ---- return; case INCLUDE: /* #included file */ ! fetch_include_from_dbase(symbol, sizeof(symbol)); goto output; } dbputc(type); skiprefchar(); ! fetch_string_from_dbase(symbol, sizeof(symbol)); goto output; } *************** *** 693,697 **** if (isalpha((unsigned char)c) || c == '_') { blockp = cp; ! putstring(symbol); type = ' '; output: --- 694,698 ---- if (isalpha((unsigned char)c) || c == '_') { blockp = cp; ! fetch_string_from_dbase(symbol, sizeof(symbol)); type = ' '; output: *************** *** 724,732 **** /* process the #included file in the old database */ static void ! putinclude(char *s) { dbputc(INCLUDE); skiprefchar(); ! putstring(s); incfile(s + 1, s); } --- 725,733 ---- /* process the #included file in the old database */ static void ! fetch_include_from_dbase(char *s, size_t length) { dbputc(INCLUDE); skiprefchar(); ! fetch_string_from_dbase(s, length); incfile(s + 1, s); } Index: command.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/command.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** command.c 21 Apr 2006 10:45:48 -0000 1.30 --- command.c 23 Jul 2006 20:59:20 -0000 1.31 *************** *** 38,41 **** --- 38,43 ---- #include "global.h" #include "build.h" /* for rebuild() */ + #include "alloc.h" + #include <stdlib.h> #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) Index: constants.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/constants.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** constants.h 30 Apr 2004 15:28:25 -0000 1.13 --- constants.h 23 Jul 2006 20:59:20 -0000 1.14 *************** *** 65,69 **** #define DEL '\177' /* delete character */ #define DUMMYCHAR ' ' /* use space as a dummy character */ ! #define MSGLEN PATLEN + 80 /* displayed message length */ #define NUMLEN 5 /* line number length */ #define PATHLEN 250 /* file pathname length */ --- 65,69 ---- #define DEL '\177' /* delete character */ #define DUMMYCHAR ' ' /* use space as a dummy character */ ! #define MSGLEN ((PATLEN) + 80) /* displayed message length */ #define NUMLEN 5 /* line number length */ #define PATHLEN 250 /* file pathname length */ Index: crossref.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/crossref.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** crossref.c 21 Apr 2006 10:45:48 -0000 1.13 --- crossref.c 23 Jul 2006 20:59:20 -0000 1.14 *************** *** 41,44 **** --- 41,45 ---- #include "build.h" #include "scanner.h" + #include "alloc.h" #include <stdlib.h> Index: dir.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/dir.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -r1.26 -r1.27 *** dir.c 21 Apr 2006 10:45:48 -0000 1.26 --- dir.c 23 Jul 2006 20:59:20 -0000 1.27 *************** *** 37,46 **** */ #include <stdlib.h> #include <sys/types.h> /* needed by stat.h and dirent.h */ #include <dirent.h> #include <sys/stat.h> /* stat */ - #include "global.h" - #include "vp.h" /* vpdirs and vpndirs */ static char const rcsid[] = "$Id$"; --- 37,48 ---- */ + #include "global.h" + #include "alloc.h" + #include "vp.h" /* vpdirs and vpndirs */ + #include <stdlib.h> #include <sys/types.h> /* needed by stat.h and dirent.h */ #include <dirent.h> #include <sys/stat.h> /* stat */ static char const rcsid[] = "$Id$"; *************** *** 123,127 **** makevpsrcdirs(); /* make the view source directory list */ ! dirlist = stralloc(dirlist); /* don't change environment variable text */ /* parse the directory list */ --- 125,129 ---- makevpsrcdirs(); /* make the view source directory list */ ! dirlist = my_strdup(dirlist); /* don't change environment variable text */ /* parse the directory list */ *************** *** 165,169 **** srcdirs = myrealloc(srcdirs, msrcdirs * sizeof(char *)); } ! srcdirs[nsrcdirs++] = stralloc(dir); } } --- 167,171 ---- srcdirs = myrealloc(srcdirs, msrcdirs * sizeof(char *)); } ! srcdirs[nsrcdirs++] = my_strdup(dir); } } *************** *** 191,195 **** makevpsrcdirs(); /* make the view source directory list */ ! dirlist = stralloc(dirlist); /* don't change environment variable text */ /* parse the directory list */ --- 193,197 ---- makevpsrcdirs(); /* make the view source directory list */ ! dirlist = my_strdup(dirlist); /* don't change environment variable text */ /* parse the directory list */ *************** *** 237,242 **** mincdirs * sizeof(char *)); } ! incdirs[nincdirs] = stralloc(path); ! incnames[nincdirs++] = stralloc(name); } } --- 239,244 ---- mincdirs * sizeof(char *)); } ! incdirs[nincdirs] = my_strdup(path); ! incnames[nincdirs++] = my_strdup(name); } } *************** *** 683,689 **** } /* add the file to the list */ ! srcfiles[nsrcfiles++] = stralloc(compath(path)); p = mymalloc(sizeof(struct listitem)); ! p->text = stralloc(compath(path)); i = hash(p->text) % HASHMOD; p->next = srcnames[i]; --- 685,691 ---- } /* add the file to the list */ ! srcfiles[nsrcfiles++] = my_strdup(compath(path)); p = mymalloc(sizeof(struct listitem)); ! p->text = my_strdup(compath(path)); i = hash(p->text) % HASHMOD; p->next = srcnames[i]; Index: display.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/display.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -r1.27 -r1.28 *** display.c 21 Apr 2006 10:45:48 -0000 1.27 --- display.c 23 Jul 2006 20:59:20 -0000 1.28 *************** *** 38,41 **** --- 38,42 ---- #include "global.h" #include "build.h" + #include "alloc.h" #ifdef CCS *************** *** 44,47 **** --- 45,49 ---- #include "version.h" /* FILEVERSION and FIXVERSION */ #endif + #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) #include <ncurses.h> Index: find.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/find.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** find.c 21 Apr 2006 10:45:48 -0000 1.18 --- find.c 23 Jul 2006 20:59:20 -0000 1.19 *************** *** 40,43 **** --- 40,45 ---- #include "build.h" #include "scanner.h" /* for token definitions */ + + #include <assert.h> #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) #include <ncurses.h> *************** *** 93,96 **** --- 95,99 ---- char *cp; char *s; + size_t s_len = 0; char firstchar; /* first character of a potential symbol */ BOOL fcndef = NO; *************** *** 110,118 **** } ! (void) scanpast('\t'); /* find the end of the header */ ! skiprefchar(); /* skip the file marker */ ! putstring(file); /* save the file name */ ! (void) strcpy(function, global);/* set the dummy global function name */ ! (void) strcpy(macro, global);/* set the dummy global macro name */ /* find the next symbol */ --- 113,121 ---- } ! (void) scanpast('\t'); /* find the end of the header */ ! skiprefchar(); /* skip the file marker */ ! fetch_string_from_dbase(file, sizeof(file)); ! strcpy(function, global); /* set the dummy global function name */ ! strcpy(macro, global); /* set the dummy global macro name */ /* find the next symbol */ *************** *** 144,148 **** /* save the name */ skiprefchar(); ! putstring(file); /* check for the end of the symbols */ --- 147,151 ---- /* save the name */ skiprefchar(); ! fetch_string_from_dbase(file, sizeof(file)); /* check for the end of the symbols */ *************** *** 159,163 **** case FCNDEF: /* function name */ fcndef = YES; ! s = function; break; --- 162,167 ---- case FCNDEF: /* function name */ fcndef = YES; ! s = function; ! s_len = sizeof(function); break; *************** *** 165,171 **** if (fileversion >= 10) { s = macro; ! } ! else { s = symbol; } break; --- 169,176 ---- if (fileversion >= 10) { s = macro; ! s_len = sizeof(macro); ! } else { s = symbol; + s_len = sizeof(symbol); } break; *************** *** 183,187 **** /* save the name */ skiprefchar(); ! putstring(s); /* see if this is a regular expression pattern */ --- 188,192 ---- /* save the name */ skiprefchar(); ! fetch_string_from_dbase(s, s_len); /* see if this is a regular expression pattern */ *************** *** 221,225 **** if (isalpha((unsigned char)firstchar) || firstchar == '_') { blockp = cp; ! putstring(symbol); if (caseless == YES) { s = lcasify(symbol); /* point to lower case version */ --- 226,230 ---- if (isalpha((unsigned char)firstchar) || firstchar == '_') { blockp = cp; ! fetch_string_from_dbase(symbol, sizeof(symbol)); if (caseless == YES) { s = lcasify(symbol); /* point to lower case version */ *************** *** 302,306 **** case NEWFILE: skiprefchar(); /* save file name */ ! putstring(file); if (*file == '\0') { /* if end of symbols */ return NULL; --- 307,311 ---- case NEWFILE: skiprefchar(); /* save file name */ ! fetch_string_from_dbase(file, sizeof(file)); if (*file == '\0') { /* if end of symbols */ return NULL; *************** *** 346,350 **** case NEWFILE: skiprefchar(); /* save file name */ ! putstring(file); if (*file == '\0') { /* if end of symbols */ return NULL; --- 351,355 ---- case NEWFILE: skiprefchar(); /* save file name */ ! fetch_string_from_dbase(file, sizeof(file)); if (*file == '\0') { /* if end of symbols */ return NULL; *************** *** 360,364 **** case CLASSDEF: skiprefchar(); /* save function name */ ! putstring(function); /* output the file, function and source line */ --- 365,369 ---- case CLASSDEF: skiprefchar(); /* save function name */ ! fetch_string_from_dbase(function, sizeof(function)); /* output the file, function and source line */ *************** *** 403,407 **** case NEWFILE: /* save file name */ skiprefchar(); ! putstring(file); if (*file == '\0') { /* if end of symbols */ return NULL; --- 408,412 ---- case NEWFILE: /* save file name */ skiprefchar(); ! fetch_string_from_dbase(file, sizeof(file)); if (*file == '\0') { /* if end of symbols */ return NULL; *************** *** 414,418 **** if (fileversion >= 10) { skiprefchar(); ! putstring(macro); } break; --- 419,423 ---- if (fileversion >= 10) { skiprefchar(); ! fetch_string_from_dbase(macro, sizeof(macro)); } break; *************** *** 424,428 **** case FCNDEF: /* save calling function name */ skiprefchar(); ! putstring(function); for (i = 0; i < morefuns; i++) if ( !strcmp(tmpfunc[i], function) ) --- 429,433 ---- case FCNDEF: /* save calling function name */ skiprefchar(); ! fetch_string_from_dbase(function, sizeof(function)); for (i = 0; i < morefuns; i++) if ( !strcmp(tmpfunc[i], function) ) *************** *** 560,564 **** case NEWFILE: /* save file name */ skiprefchar(); ! putstring(file); if (*file == '\0') { /* if end of symbols */ return NULL; --- 565,569 ---- case NEWFILE: /* save file name */ skiprefchar(); ! fetch_string_from_dbase(file, sizeof(file)); if (*file == '\0') { /* if end of symbols */ return NULL; *************** *** 711,715 **** /* see if this is a regular expression pattern */ if (isregexp_valid == YES) { ! putstring(string); if (*string == '\0') { return(NO); --- 716,720 ---- /* see if this is a regular expression pattern */ if (isregexp_valid == YES) { ! fetch_string_from_dbase(string, sizeof(string)); if (*string == '\0') { return(NO); *************** *** 858,889 **** } - /* put the rest of the cross-reference line into the string */ void ! putstring(char *s) { char *cp; ! unsigned c; ! setmark('\n'); cp = blockp; do { ! while ((c = (unsigned)(*cp)) != '\n') { ! if (c > '\177') { ! c &= 0177; *s++ = dichar1[c / 8]; *s++ = dichar2[c & 7]; ! } ! else { *s++ = c; } ++cp; } ! } while (*(cp + 1) == '\0' && (cp = read_block()) != NULL); blockp = cp; *s = '\0'; } - /* scan past the next occurence of this character in the cross-reference */ char * scanpast(char c) --- 863,898 ---- } + /* put the rest of the cross-reference line into the string */ void ! fetch_string_from_dbase(char *s, size_t length) { char *cp; ! unsigned int c; ! ! assert(length > sizeof (char *)); ! setmark('\n'); cp = blockp; do { ! while (length > 1 && (c = (unsigned int)(*cp)) != '\n') { ! if (c >= 0x80 && length > 2) { ! c &= 0x7f; *s++ = dichar1[c / 8]; *s++ = dichar2[c & 7]; ! length -= 2; ! } else { *s++ = c; + length--; } ++cp; } ! } while (length > 0 && cp[1] == '\0' && (cp = read_block()) != NULL); blockp = cp; *s = '\0'; } + + /* scan past the next occurence of this character in the cross-reference */ char * scanpast(char c) *************** *** 980,984 **** case NEWFILE: skiprefchar(); /* save file name */ ! putstring(file); if (*file == '\0') { /* if end of symbols */ return(&found_caller); --- 989,993 ---- case NEWFILE: skiprefchar(); /* save file name */ ! fetch_string_from_dbase(file, sizeof(file)); if (*file == '\0') { /* if end of symbols */ return(&found_caller); *************** *** 1115,1119 **** if (dbseek(p->lineoffset) != -1) { scanpast(FCNDEF); ! putstring(function); } } --- 1124,1129 ---- if (dbseek(p->lineoffset) != -1) { scanpast(FCNDEF); ! fetch_string_from_dbase(function, ! sizeof(function)); } } *************** *** 1124,1128 **** else if (p->fcnoffset != lastfcnoffset) { if (dbseek(p->fcnoffset) != -1) { ! putstring(function); lastfcnoffset = p->fcnoffset; } --- 1134,1138 ---- else if (p->fcnoffset != lastfcnoffset) { if (dbseek(p->fcnoffset) != -1) { ! fetch_string_from_dbase(function, sizeof(function)); lastfcnoffset = p->fcnoffset; } Index: fscanner.l =================================================================== RCS file: /cvsroot/cscope/cscope/src/fscanner.l,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** fscanner.l 6 May 2006 13:07:39 -0000 1.10 --- fscanner.l 23 Jul 2006 20:59:20 -0000 1.11 *************** *** 37,40 **** --- 37,41 ---- */ #include "global.h" + #include "alloc.h" #include "scanner.h" #include "lookup.h" Index: global.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/global.h,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** global.h 21 Apr 2006 10:45:48 -0000 1.34 --- global.h 23 Jul 2006 20:59:20 -0000 1.35 *************** *** 381,385 **** void postfatal(const char *msg,...); void putposting(char *term, int type); ! void putstring(char *s); void resetcmd(void); void seekline(unsigned int line); --- 381,385 ---- void postfatal(const char *msg,...); void putposting(char *term, int type); ! void fetch_string_from_dbase(char *, size_t); void resetcmd(void); void seekline(unsigned int line); Index: history.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/history.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** history.c 3 May 2000 22:02:10 -0000 1.2 --- history.c 23 Jul 2006 20:59:20 -0000 1.3 *************** *** 38,41 **** --- 38,43 ---- #include "global.h" + #include "alloc.h" + static char const rcsid[] = "$Id$"; *************** *** 59,63 **** } h->field = f; ! h->text = stralloc( s); current = 0; } --- 61,65 ---- } h->field = f; ! h->text = my_strdup( s); current = 0; } Index: library.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/library.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** library.h 21 Apr 2006 10:45:48 -0000 1.10 --- library.h 23 Jul 2006 20:59:20 -0000 1.11 *************** *** 43,53 **** char *logdir(char *name); char *mybasename(char *path); - void *mycalloc(size_t nelem, size_t size); FILE *myfopen(char *path, char *mode); char *mygetenv(char *variable, char *deflt); - void *mymalloc(size_t size); int myopen(char *path, int flag, int mode); - void *myrealloc(void *p, size_t size); - char *stralloc(char *s); FILE *mypopen(char *cmd, char *mode); int mypclose(FILE *ptr); --- 43,49 ---- *************** *** 55,64 **** void egrepcaseless(int i); - /* Programmer's Workbench library (-lPW) */ - /* FIXME HBB 20010705: these should never be here. We should just - * #include the relevant header, instead. Moreover, they don't seem - * to be used, anyway ... */ - #if 0 - char *regcmp(), *regex(); - #endif #endif /* CSCOPE_LIBRARY_H */ --- 51,53 ---- Index: main.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/main.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -r1.39 -r1.40 *** main.c 21 Apr 2006 10:45:48 -0000 1.39 --- main.c 23 Jul 2006 20:59:20 -0000 1.40 *************** *** 43,46 **** --- 43,48 ---- #include "version.h" /* FILEVERSION and FIXVERSION */ #include "scanner.h" + #include "alloc.h" + #include <stdlib.h> /* atoi */ #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) *************** *** 278,284 **** s = path + strlen(path); strcpy(s, ".in"); ! invname = stralloc(path); strcpy(s, ".po"); ! invpost = stralloc(path); break; case 'F': /* symbol reference lines file */ --- 280,286 ---- s = path + strlen(path); strcpy(s, ".in"); ! invname = my_strdup(path); strcpy(s, ".po"); ! invpost = my_strdup(path); break; case 'F': /* symbol reference lines file */ *************** *** 385,393 **** sprintf(path, "%s/%s", home, reffile); if (isuptodate == NO || access(path, READ) == 0) { ! reffile = stralloc(path); sprintf(path, "%s/%s", home, invname); ! invname = stralloc(path); sprintf(path, "%s/%s", home, invpost); ! invpost = stralloc(path); } } --- 387,395 ---- sprintf(path, "%s/%s", home, reffile); if (isuptodate == NO || access(path, READ) == 0) { ! reffile = my_strdup(path); sprintf(path, "%s/%s", home, invname); ! invname = my_strdup(path); sprintf(path, "%s/%s", home, invpost); ! invpost = my_strdup(path); } } *************** *** 527,531 **** /* NOTREACHED */ } ! srcfiles[i] = stralloc(path); } } --- 529,533 ---- /* NOTREACHED */ } ! srcfiles[i] = my_strdup(path); } } Index: vpinit.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/vpinit.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** vpinit.c 21 Feb 2006 19:54:57 -0000 1.7 --- vpinit.c 23 Jul 2006 20:59:20 -0000 1.8 *************** *** 38,41 **** --- 38,42 ---- #include <unistd.h> #include "vp.h" + #include "alloc.h" #include "library.h" #include "global.h" *************** *** 108,112 **** /* don't change VPATH in the environment */ ! vpath = stralloc(vpath); /* split the view path into nodes */ --- 109,113 ---- /* don't change VPATH in the environment */ ! vpath = my_strdup(vpath); /* split the view path into nodes */ |