03fafea40efcb09c405474885289672fac9b9383 braney Sun Sep 29 12:08:23 2013 -0700 fix error in the size of a buffer allocation diff --git src/lib/bPlusTree.c src/lib/bPlusTree.c index c5cece5..05bdfab 100644 --- src/lib/bPlusTree.c +++ src/lib/bPlusTree.c @@ -331,31 +331,31 @@ { assert(maxResultSize > bpt->keySize); bptKeyAtPos(bpt, itemPos, result); result[bpt->keySize] = 0; } static boolean bptFileFindMaybeMulti(struct bptFile *bpt, void *key, int keySize, int valSize, boolean multi, void *singleVal, struct slRef **multiVal) /* Do either a single or multiple find depending in multi parameter. Only one of singleVal * or multiVal should be non-NULL, depending on the same parameter. */ { /* Check key size vs. file key size, and act appropriately. If need be copy key to a local * buffer and zero-extend it. */ if (keySize > bpt->keySize) return FALSE; -char keyBuf[keySize]; +char keyBuf[bpt->keySize]; if (keySize != bpt->keySize) { memcpy(keyBuf, key, keySize); memset(keyBuf+keySize, 0, bpt->keySize - keySize); key = keyBuf; } /* Make sure the valSize matches what's in file. */ if (valSize != bpt->valSize) errAbort("Value size mismatch between bptFileFind (valSize=%d) and %s (valSize=%d)", valSize, bpt->fileName, bpt->valSize); if (multi) { rFindMulti(bpt, bpt->rootOffset, key, multiVal);