diff options
author | René Mayrhofer <rene@mayrhofer.eu.org> | 2011-05-19 13:37:29 +0200 |
---|---|---|
committer | René Mayrhofer <rene@mayrhofer.eu.org> | 2011-05-19 13:37:29 +0200 |
commit | 0a9d51a49042a68daa15b0c74a2b7f152f52606b (patch) | |
tree | 451888dcb17d00e52114f734e846821373fbbd44 /src/libfreeswan/satot.c | |
parent | 568905f488e63e28778f87ac0e38d845f45bae79 (diff) | |
download | vyos-strongswan-0a9d51a49042a68daa15b0c74a2b7f152f52606b.tar.gz vyos-strongswan-0a9d51a49042a68daa15b0c74a2b7f152f52606b.zip |
Imported Upstream version 4.5.2
Diffstat (limited to 'src/libfreeswan/satot.c')
-rw-r--r-- | src/libfreeswan/satot.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libfreeswan/satot.c b/src/libfreeswan/satot.c index e70036482..a3feb1591 100644 --- a/src/libfreeswan/satot.c +++ b/src/libfreeswan/satot.c @@ -77,7 +77,7 @@ size_t dstlen; break; /* NOTE BREAK OUT */ } if (pre == NULL) { /* unknown protocol */ - strcpy(unk, "unk"); + strncpy(unk, "unk", sizeof(unk)); (void) ultot((unsigned char)sa->proto, 10, unk+strlen(unk), sizeof(unk)-strlen(unk)); pre = unk; @@ -86,9 +86,9 @@ size_t dstlen; if (strcmp(pre, PASSTHROUGHTYPE) == 0 && sa->spi == PASSTHROUGHSPI && isunspecaddr(&sa->dst)) { - strcpy(buf, (addrtypeof(&sa->dst) == AF_INET) ? + strncpy(buf, (addrtypeof(&sa->dst) == AF_INET) ? PASSTHROUGH4NAME : - PASSTHROUGH6NAME); + PASSTHROUGH6NAME, sizeof(buf)); len = strlen(buf); } @@ -104,13 +104,13 @@ size_t dstlen; default: p = NULL; break; } if (p != NULL) { - strcpy(buf, p); + strncpy(buf, p, sizeof(buf)); len = strlen(buf); } } if (len == 0) { /* general case needed */ - strcpy(buf, pre); + strncpy(buf, pre, sizeof(buf)); len = strlen(buf); if (showversion) { *(buf+len) = (addrtypeof(&sa->dst) == AF_INET) ? '.' : @@ -126,7 +126,7 @@ size_t dstlen; if (dst != NULL) { if (len > dstlen) *(buf+dstlen-1) = '\0'; - strcpy(dst, buf); + strncpy(dst, buf, dstlen); } return len; } |