Run-Time Check Failure #2 - Stack around the variable 'tab' was corrupted
	
	
		Salut tout le monde,
Je programme sous Visual Studio 2005 et à la sortie du main VC me renvoie l'erreur ci dessous:
"Run-Time Check Failure #2 - Stack around the variable 'tab' was corrupted"
Voici mon code pour plus de détail:
	Code:
	
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 
 | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
 
#define LINE_MAX (int) (10)
 
void read_input(char** buff)
{
    int i = 0, j = 0, c;
 
    //reads one line from stdin
    while((c = fgetc(stdin)) != '\n')
    {
        if (!isspace(c))
        {
            char *ptr = buff[i];
            buff[i] = (char*)realloc(ptr, (j+1)*sizeof(char));
            buff[i][j] = c;
            j++;
        }
        else
        {
            buff[i][j] = '\0';
            i++;
            j = 0;
        }
    }
}
 
int main(int argc, char** argv)
{
    int N = 0, M = 0, m = 0;
    char* tab = NULL;
    char** buff = &tab;
 
    *buff = (char*)malloc(LINE_MAX * sizeof(char));
    for(m; m<LINE_MAX; m++)
    {
        buff[m] = (char*)malloc(sizeof(char));
    }
 
    read_input(buff);
 
    N = atoi(buff[0]);
    M = atoi(buff[1]);
 
    return 0;
} | 
 Le code fonctionne exactement comme prévu jusqu'au "return 0" où ça plante...
Est ce que quelqu'un voit la source de l'erreur ? Merci pour les remarques ...