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 6c62c68..8564b28 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)) {