Samuel Thibault, le Tue 17 Jan 2012 14:23:54 +0100, a écrit : > if (len + 1 > allocated) { > unsigned new_allocated = 2 * allocated; That was bogus of course, it should be 2*(len+1) instead of 2*allocated. > void *new_bname = malloc(new_allocated); > if (!new_bname) > return NULL; > allocated = new_allocated; > free(bname); > bname = new_bname; > } > > (void)strncpy(bname, startp, len); > > bname[len] = '\0'; > > return(bname); > > }