memory: Fix buffer overflow when position == NUM_BUFFERS
authorJames Cowgill <james410@cowgill.org.uk>
Fri, 5 May 2017 09:33:56 +0000 (10:33 +0100)
committerJames Cowgill <james410@cowgill.org.uk>
Fri, 5 May 2017 16:47:03 +0000 (17:47 +0100)
driver/others/memory.c

index 6c62c686e506d7664c647f56eed1dff233bf3dd5..8564b285bccfc78d09a8b21c77017d9b1d57b3bd 100644 (file)
@@ -1015,7 +1015,7 @@ void *blas_memory_alloc(int procpos){
   mypos = WhereAmI();
 
   position = mypos;
-  while (position > NUM_BUFFERS) position >>= 1;
+  while (position >= NUM_BUFFERS) position >>= 1;
 
   do {
     if (!memory[position].used && (memory[position].pos == mypos)) {