There are a couple of ways to approach it. Either declare them as much larger than you ever expect or check the size received and reallocate if needed.
Going back to your first post, I see you set them to 30 bytes
struct item_inside_struct {
char item[30];
char serial[30];
int quantity;
};
so if that is larger than you expect to receive, then it should be OK (but I'd recommend either checking before copying or using e.g. "strncpy").
It's also possible to declare them as char* types and allocate an initial size, then use "realloc" to increase the size if the received string is larger, but that would require additional checks and keeping note of the allocated size etc. This is a more memory-efficient method, but more complex to code.