diff options
author | corvid <devnull@localhost> | 2015-07-05 17:00:11 +0000 |
---|---|---|
committer | corvid <devnull@localhost> | 2015-07-05 17:00:11 +0000 |
commit | 78c910dc93d8772a0b1af7fc6ae3865e2efdfb3c (patch) | |
tree | 24507d33f3ea0f3c0f522a08a85576b9172d9261 /src/IO/tls.c | |
parent | 48f7f6645e665e174f687d2caebeb803a06c1fea (diff) |
wasteful use of strncpy
I never knew that if you give it a small string to copy into a big buffer,
it'll waste time filling the rest of it with '\0'.
Diffstat (limited to 'src/IO/tls.c')
-rw-r--r-- | src/IO/tls.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/IO/tls.c b/src/IO/tls.c index c1062c9a..3d14deef 100644 --- a/src/IO/tls.c +++ b/src/IO/tls.c @@ -781,7 +781,7 @@ static void Tls_get_issuer_name(X509 *cert, char *buf, uint_t buflen) if (cert) { X509_NAME_oneline(X509_get_issuer_name(cert), buf, buflen); } else { - strncpy(buf, "(unknown)", buflen); + strcpy(buf, "(unknown)"); buf[buflen-1] = '\0'; } } @@ -796,7 +796,7 @@ static void Tls_get_expiration_str(X509 *cert, char *buf, uint_t buflen) rc = BIO_gets(b, buf, buflen); } if (rc <= 0) { - strncpy(buf, "(unknown)", buflen); + strcpy(buf, "(unknown)"); buf[buflen-1] = '\0'; } BIO_free(b); |