Skip to content

Commit

Permalink
ZonedExtra.h: use strncpy() instead of memcpy() to prevent compiler w…
Browse files Browse the repository at this point in the history
…arnings on STM32duino
  • Loading branch information
bxparks committed Jun 26, 2023
1 parent fb95357 commit 61c795b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ace_time/ZonedExtra.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef ACE_TIME_ZONED_EXTRA_H
#define ACE_TIME_ZONED_EXTRA_H

#include <string.h> // memcpy()
#include <string.h> // strncpy()
#include <stdint.h>
#include "common/common.h" // acetime_t, kAbbrevSize
#include "TimeOffset.h"
Expand Down Expand Up @@ -97,7 +97,7 @@ class ZonedExtra {
, mReqDstOffsetSeconds(reqDstOffsetSeconds)
, mType(type)
{
memcpy(mAbbrev, abbrev, internal::kAbbrevSize);
strncpy(mAbbrev, abbrev, internal::kAbbrevSize - 1);
mAbbrev[internal::kAbbrevSize - 1] = '\0';
}

Expand Down

0 comments on commit 61c795b

Please sign in to comment.