9cc44f3539c422b2ccca8345eb0751439450dee0 angie Thu Dec 20 13:52:51 2018 -0800 Fixing mem-overwriting bug found when linefile.c has an artificially low starting buffer size for testing. Doesn't apply in normal use, just fixing so I can test lineFile's buffering logic. diff --git src/hg/lib/lav.c src/hg/lib/lav.c index 225990f..017431d 100644 --- src/hg/lib/lav.c +++ src/hg/lib/lav.c @@ -109,32 +109,34 @@ char *line, *words[64]; int i, size, wordCount = 0; struct axtScoreScheme *ss = NULL; freez(matrix); freez(command); if (!lineFileNext(lf, &line, &size)) unexpectedEof(lf); if (stringIn("lastz",line)) { stripChar(line,'"'); wordCount = chopLine(line, words); fprintf(f, "##aligner=%s",words[0]); for (i = 3 ; i <wordCount ; i++) fprintf(f, " %s ",words[i]); fprintf(f,"\n"); + char aligner[strlen(words[0])+1]; + safecpy(aligner, sizeof aligner, words[0]); ss = axtScoreSchemeReadLf(lf); - axtScoreSchemeDnaWrite(ss, f, words[0]); + axtScoreSchemeDnaWrite(ss, f, aligner); } seekEndOfStanza(lf); } struct block *removeFrayedEnds(struct block *blockList) /* Remove zero length blocks at start and/or end to * work around blastz bug. */ { struct block *block = blockList; struct block *lastBlock = NULL; if (block != NULL && block->qStart == block->qEnd) { verbose(2,"removeFrayedEnds: first block: %d == %d\n", block->qStart, block->qEnd); blockList = blockList->next;