diff --git a/drivers/timers/rtc.c b/drivers/timers/rtc.c index e375cfa64f..7614000258 100644 --- a/drivers/timers/rtc.c +++ b/drivers/timers/rtc.c @@ -819,7 +819,7 @@ static int rtc_unlink(FAR struct inode *inode) int rtc_initialize(int minor, FAR struct rtc_lowerhalf_s *lower) { FAR struct rtc_upperhalf_s *upper; - char devpath[16]; + char devpath[20]; int ret; DEBUGASSERT(lower && lower->ops && minor >= 0 && minor < 1000); @@ -844,11 +844,11 @@ int rtc_initialize(int minor, FAR struct rtc_lowerhalf_s *lower) upper->unlinked = false; /* Driver is not unlinked */ #endif - /* Create the driver name. There is space for the a minor number up to 6 + /* Create the driver name. There is space for the a minor number up to 10 * characters */ - snprintf(devpath, 16, "/dev/rtc%d", minor); + snprintf(devpath, sizeof(devpath), "/dev/rtc%d", minor); /* And, finally, register the new RTC driver */