summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bio
diff options
context:
space:
mode:
authorbeck <>2014-04-19 00:41:38 +0000
committerbeck <>2014-04-19 00:41:38 +0000
commitf15b58ab9c9f635ba829753251c22b3da4683b00 (patch)
tree174c4c233f06a12ea563fd4e4c48bc26d4bdede3 /src/lib/libcrypto/bio
parent4855ea84e69fe2edcf4d523233d15c950bd77e4d (diff)
downloadopenbsd-f15b58ab9c9f635ba829753251c22b3da4683b00.tar.gz
openbsd-f15b58ab9c9f635ba829753251c22b3da4683b00.tar.bz2
openbsd-f15b58ab9c9f635ba829753251c22b3da4683b00.zip
use intrinsic strlcpy and strlcat everywhere so we only have one set of
funcitons to check for incorrect use. keep BUF_strlcpy and BUF_strlcat for API comptibility only. ok tedu@
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/bio/b_dump.c14
-rw-r--r--src/lib/libcrypto/bio/bss_file.c10
2 files changed, 12 insertions, 12 deletions
diff --git a/src/lib/libcrypto/bio/b_dump.c b/src/lib/libcrypto/bio/b_dump.c
index ff75069df8..61c9fe20a3 100644
--- a/src/lib/libcrypto/bio/b_dump.c
+++ b/src/lib/libcrypto/bio/b_dump.c
@@ -107,29 +107,29 @@ BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u),
107 rows++; 107 rows++;
108 for (i = 0; i < rows; i++) { 108 for (i = 0; i < rows; i++) {
109 buf[0] = '\0'; /* start with empty string */ 109 buf[0] = '\0'; /* start with empty string */
110 BUF_strlcpy(buf, str, sizeof buf); 110 strlcpy(buf, str, sizeof buf);
111 (void) snprintf(tmp, sizeof tmp, "%04x - ", i*dump_width); 111 (void) snprintf(tmp, sizeof tmp, "%04x - ", i*dump_width);
112 BUF_strlcat(buf, tmp, sizeof buf); 112 strlcat(buf, tmp, sizeof buf);
113 for (j = 0; j < dump_width; j++) { 113 for (j = 0; j < dump_width; j++) {
114 if (((i*dump_width) + j) >= len) { 114 if (((i*dump_width) + j) >= len) {
115 BUF_strlcat(buf, " ", sizeof buf); 115 strlcat(buf, " ", sizeof buf);
116 } else { 116 } else {
117 ch = ((unsigned char)*(s + i*dump_width + j)) & 0xff; 117 ch = ((unsigned char)*(s + i*dump_width + j)) & 0xff;
118 (void) snprintf(tmp, sizeof tmp, "%02x%c", ch, 118 (void) snprintf(tmp, sizeof tmp, "%02x%c", ch,
119 j == 7 ? '-' : ' '); 119 j == 7 ? '-' : ' ');
120 BUF_strlcat(buf, tmp, sizeof buf); 120 strlcat(buf, tmp, sizeof buf);
121 } 121 }
122 } 122 }
123 BUF_strlcat(buf, " ", sizeof buf); 123 strlcat(buf, " ", sizeof buf);
124 for (j = 0; j < dump_width; j++) { 124 for (j = 0; j < dump_width; j++) {
125 if (((i*dump_width) + j) >= len) 125 if (((i*dump_width) + j) >= len)
126 break; 126 break;
127 ch = ((unsigned char)*(s + i * dump_width + j)) & 0xff; 127 ch = ((unsigned char)*(s + i * dump_width + j)) & 0xff;
128 (void) snprintf(tmp, sizeof tmp, "%c", 128 (void) snprintf(tmp, sizeof tmp, "%c",
129 ((ch >= ' ') && (ch <= '~')) ? ch : '.'); 129 ((ch >= ' ') && (ch <= '~')) ? ch : '.');
130 BUF_strlcat(buf, tmp, sizeof buf); 130 strlcat(buf, tmp, sizeof buf);
131 } 131 }
132 BUF_strlcat(buf, "\n", sizeof buf); 132 strlcat(buf, "\n", sizeof buf);
133 /* if this is the last call then update the ddt_dump thing so 133 /* if this is the last call then update the ddt_dump thing so
134 * that we will move the selection point in the debug window 134 * that we will move the selection point in the debug window
135 */ 135 */
diff --git a/src/lib/libcrypto/bio/bss_file.c b/src/lib/libcrypto/bio/bss_file.c
index 995c623341..acc746260e 100644
--- a/src/lib/libcrypto/bio/bss_file.c
+++ b/src/lib/libcrypto/bio/bss_file.c
@@ -246,14 +246,14 @@ file_ctrl(BIO *b, int cmd, long num, void *ptr)
246 b->shutdown = (int)num&BIO_CLOSE; 246 b->shutdown = (int)num&BIO_CLOSE;
247 if (num & BIO_FP_APPEND) { 247 if (num & BIO_FP_APPEND) {
248 if (num & BIO_FP_READ) 248 if (num & BIO_FP_READ)
249 BUF_strlcpy(p, "a+", sizeof p); 249 strlcpy(p, "a+", sizeof p);
250 else BUF_strlcpy(p, "a", sizeof p); 250 else strlcpy(p, "a", sizeof p);
251 } else if ((num & BIO_FP_READ) && (num & BIO_FP_WRITE)) 251 } else if ((num & BIO_FP_READ) && (num & BIO_FP_WRITE))
252 BUF_strlcpy(p, "r+", sizeof p); 252 strlcpy(p, "r+", sizeof p);
253 else if (num & BIO_FP_WRITE) 253 else if (num & BIO_FP_WRITE)
254 BUF_strlcpy(p, "w", sizeof p); 254 strlcpy(p, "w", sizeof p);
255 else if (num & BIO_FP_READ) 255 else if (num & BIO_FP_READ)
256 BUF_strlcpy(p, "r", sizeof p); 256 strlcpy(p, "r", sizeof p);
257 else { 257 else {
258 BIOerr(BIO_F_FILE_CTRL, BIO_R_BAD_FOPEN_MODE); 258 BIOerr(BIO_F_FILE_CTRL, BIO_R_BAD_FOPEN_MODE);
259 ret = 0; 259 ret = 0;