Index: uspace/app/filegen/filegen.c
===================================================================
--- uspace/app/filegen/filegen.c	(revision 010b52d861f50e5344d6b50b363be69e23e5f313)
+++ uspace/app/filegen/filegen.c	(revision b9060a83c1ed3bcb6f91a9cffcfd0d27415856f4)
@@ -73,5 +73,5 @@
 	close(fd);
 	crc = ~crc;
-	printf("%s: %x\n", argv[1], crc);
+	printf("%s : %x\n", argv[1], crc);
 
 	return 0;
Index: uspace/srv/fs/fat/fat_fat.c
===================================================================
--- uspace/srv/fs/fat/fat_fat.c	(revision 010b52d861f50e5344d6b50b363be69e23e5f313)
+++ uspace/srv/fs/fat/fat_fat.c	(revision b9060a83c1ed3bcb6f91a9cffcfd0d27415856f4)
@@ -304,4 +304,7 @@
 
 	offset = (clst + clst/2);
+	if (offset / BPS(bs) >= SF(bs))
+		return ERANGE;
+
 	rc = block_get(&b, devmap_handle, RSCNT(bs) + SF(bs) * fatno +
 	    offset / BPS(bs), BLOCK_FLAGS_NONE);
@@ -309,8 +312,7 @@
 		return rc;
 
-	byte1 = ((uint8_t*) b->data)[offset];
-
+	byte1 = ((uint8_t*) b->data)[offset % BPS(bs)];
 	/* This cluster access spans a sector boundary. Check only for FAT12 */
-	if ((offset % BPS(bs) + 1 == BPS(bs))) {
+	if ((offset % BPS(bs)) + 1 == BPS(bs)) {
 		/* Is it last sector of FAT? */
 		if (offset / BPS(bs) < SF(bs)) {
@@ -341,5 +343,5 @@
 	}
 	else
-		byte2 = ((uint8_t*) b->data)[offset+1];
+		byte2 = ((uint8_t*) b->data)[(offset % BPS(bs))+1];
 
 #ifdef __BE__	
@@ -351,10 +353,9 @@
 	*value = uint16_t_le2host(*value);
 	if (IS_ODD(clst))
-		*value = *value >> 4;
+		*value = (*value) >> 4;
 	else
-		*value = *value & FAT12_MASK;
-
+		*value = (*value) & FAT12_MASK;
+	
 	rc = block_put(b);
-
 	return rc;
 }
@@ -473,4 +474,7 @@
 
 	offset = (clst + clst/2);
+	if (offset / BPS(bs) >= SF(bs))
+		return ERANGE;
+	
 	rc = block_get(&b, devmap_handle, RSCNT(bs) + SF(bs) * fatno +
 	    offset / BPS(bs), BLOCK_FLAGS_NONE);
@@ -478,8 +482,8 @@
 		return rc;
 
-	byte1 = ((uint8_t*) b->data)[offset];
+	byte1 = ((uint8_t*) b->data)[offset % BPS(bs)];
 	bool border = false;
 	/* This cluster access spans a sector boundary. Check only for FAT12 */
-	if (offset % BPS(bs)+1 == BPS(bs)) {
+	if ((offset % BPS(bs))+1 == BPS(bs)) {
 		/* Is it last sector of FAT? */
 		if (offset / BPS(bs) < SF(bs)) {
@@ -492,7 +496,7 @@
 			}
 			/*
-			* Combining value with last byte of current sector and
-			* first byte of next sector
-			*/
+			 * Combining value with last byte of current sector and
+			 * first byte of next sector
+			 */
 			byte2 = ((uint8_t*) b1->data)[0];
 			border = true;
@@ -505,5 +509,5 @@
 	}
 	else
-		byte2 = ((uint8_t*) b->data)[offset+1];
+		byte2 = ((uint8_t*) b->data)[(offset % BPS(bs))+1];
 
 	if (IS_ODD(clst)) {
@@ -520,5 +524,5 @@
 	byte2 = byte2 | (value >> 8);
 
-	((uint8_t*) b->data)[offset] = byte1;
+	((uint8_t*) b->data)[(offset % BPS(bs))] = byte1;
 	if (border) {
 		((uint8_t*) b1->data)[0] = byte2;
@@ -531,5 +535,5 @@
 		}
 	} else 
-		((uint8_t*) b->data)[offset+1] = byte2;
+		((uint8_t*) b->data)[(offset % BPS(bs))+1] = byte2;
 
 	b->dirty = true;	/* need to sync block */
