scanf with %s reads into a buffer without a width limit and can overflow it.
Specify a maximum field width such as %31s matching the buffer size.