strlen() however returns the number of characters in a char[] without the null terminator. Therefore it allocated a byte less than needed and the terminator is cropped during strcpy(). It may be wise to use sizeof() instead or add one byte to the malloc() request.
During construction of Part (and its subclasses), string (or char*) parameters are copied to the internal variable using the following method:
char* buf = (char*)malloc(strlen(param)); this->param = strcpy(buf, param); buf = NULL;
strlen() however returns the number of characters in a char[] without the null terminator. Therefore it allocated a byte less than needed and the terminator is cropped during strcpy(). It may be wise to use sizeof() instead or add one byte to the malloc() request.