diff --git a/cce.c b/cce.c
index 9ce93010eaa2f358deb73626e3f7611d47097912..b5bd367eac6440d023881de9b0e23fdf94bcbeff 100644
--- a/cce.c
+++ b/cce.c
@@ -185,11 +185,67 @@ char *set_error(char *codeword, int i)
 }
 
 // Q5
+int error_index(char* syndrome, int base_index) {
+    char syn[5];
+    int i;
+    for (i = 0; i < 4; i++) {
+        syn[i] = syndrome[i + base_index];
+    }
+    syn[i] = '\0';
+
+    if (strcmp(syn, "1011") == 0) {
+        return 0;
+    }
+    else if (strcmp(syn, "1100") == 0) {
+        return 1;
+    }
+    else if (strcmp(syn, "0110") == 0) {
+        return 2;
+    }
+    else if (strcmp(syn, "0011") == 0) {
+        return 3;
+    }
+    else if (strcmp(syn, "1000") == 0) {
+        return 4;
+    }
+    else if (strcmp(syn, "0100") == 0) {
+        return 5;
+    }
+    else if (strcmp(syn, "0010") == 0) {
+        return 6;
+    }
+    else if (strcmp(syn, "0001") == 0) {
+        return 7;
+    }
+    else if (strcmp(syn, "0000") == 0) {
+        return 8;
+    }
+    else {
+        exit(1);
+    }
+}
+
 char *error_correction(char *codeword)
 {
-    char *decoded;
-    // TODO : Décoder le codeword
-    // TODO : Si le syndrome est différent de 0, repérer la postion de l'erreur en fonction du syndrome
-    // TODO : Inverser le bit à la position de l'erreur
-    return decoded;
+    int i, j;
+    int error_i;
+    int lencodeword = strlen(codeword);
+    char* syndromes = polynomial_decode(codeword);
+    char* corrected = malloc(sizeof(char) * (lencodeword + 1));
+
+    for (i = 0; i < lencodeword; i++) {
+        corrected[i] = codeword[i];
+    }
+    corrected[i] = '\0';
+
+    for (i = 0, j = 0; i < lencodeword; i+= 8, j+=4) {
+        error_i = error_index(syndromes, j);
+        if (error_i != 8) {
+            corrected[i + error_i] == '0' ? '1' : '0';
+        }
+    }
+
+    free(syndromes);
+
+    return corrected;
 }