From 5ddccc937010cee05d584f4ae018548c5fed2f39 Mon Sep 17 00:00:00 2001 From: "Vanya A. Sergeev" Date: Tue, 17 Nov 2020 23:22:40 -0600 Subject: [PATCH] pwm: use strcpy() for static strings in pwm_tostring() --- src/pwm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pwm.c b/src/pwm.c index 53596b6..4db3a24 100644 --- a/src/pwm.c +++ b/src/pwm.c @@ -419,12 +419,12 @@ int pwm_tostring(pwm_t *pwm, char *str, size_t len) { const char *enabled_str; if (pwm_get_period(pwm, &period) < 0) - strncpy(period_str, "", sizeof(period_str)); + strcpy(period_str, ""); else snprintf(period_str, sizeof(period_str), "%f", period); if (pwm_get_duty_cycle(pwm, &duty_cycle) < 0) - strncpy(duty_cycle_str, "", sizeof(duty_cycle_str)); + strcpy(duty_cycle_str, ""); else snprintf(duty_cycle_str, sizeof(duty_cycle_str), "%f", duty_cycle);