diff options
author | beck <> | 2014-04-16 20:36:35 +0000 |
---|---|---|
committer | beck <> | 2014-04-16 20:36:35 +0000 |
commit | 750d86a4fc04f53024575d65269281ea6c4e450c (patch) | |
tree | 4a8d2bd6f2dd786d658a75ea2db858806f2ec5f4 /src/lib/libssl/test | |
parent | be77aa550ef0450b00eb62880d4d98112ba86e50 (diff) | |
download | openbsd-750d86a4fc04f53024575d65269281ea6c4e450c.tar.gz openbsd-750d86a4fc04f53024575d65269281ea6c4e450c.tar.bz2 openbsd-750d86a4fc04f53024575d65269281ea6c4e450c.zip |
Clean up dangerous strncpy use. This included a use where the resulting
string was potentially not nul terminated and a place where malloc return
was unchecked.
while we're at it remove dummytest.c
ok miod@
Diffstat (limited to 'src/lib/libssl/test')
-rw-r--r-- | src/lib/libssl/test/dummytest.c | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/lib/libssl/test/dummytest.c b/src/lib/libssl/test/dummytest.c deleted file mode 100644 index 5b4467e042..0000000000 --- a/src/lib/libssl/test/dummytest.c +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | #include <string.h> | ||
4 | #include <ctype.h> | ||
5 | #include <openssl/e_os2.h> | ||
6 | #include <openssl/buffer.h> | ||
7 | #include <openssl/crypto.h> | ||
8 | |||
9 | int main(int argc, char *argv[]) | ||
10 | { | ||
11 | char *p, *q = 0, *program; | ||
12 | |||
13 | p = strrchr(argv[0], '/'); | ||
14 | if (!p) p = strrchr(argv[0], '\\'); | ||
15 | #ifdef OPENSSL_SYS_VMS | ||
16 | if (!p) p = strrchr(argv[0], ']'); | ||
17 | if (p) q = strrchr(p, '>'); | ||
18 | if (q) p = q; | ||
19 | if (!p) p = strrchr(argv[0], ':'); | ||
20 | q = 0; | ||
21 | #endif | ||
22 | if (p) p++; | ||
23 | if (!p) p = argv[0]; | ||
24 | if (p) q = strchr(p, '.'); | ||
25 | if (p && !q) q = p + strlen(p); | ||
26 | |||
27 | if (!p) | ||
28 | program = BUF_strdup("(unknown)"); | ||
29 | else | ||
30 | { | ||
31 | program = OPENSSL_malloc((q - p) + 1); | ||
32 | strncpy(program, p, q - p); | ||
33 | program[q - p] = '\0'; | ||
34 | } | ||
35 | |||
36 | for(p = program; *p; p++) | ||
37 | if (islower((unsigned char)(*p))) | ||
38 | *p = toupper((unsigned char)(*p)); | ||
39 | |||
40 | q = strstr(program, "TEST"); | ||
41 | if (q > p && q[-1] == '_') q--; | ||
42 | *q = '\0'; | ||
43 | |||
44 | printf("No %s support\n", program); | ||
45 | |||
46 | OPENSSL_free(program); | ||
47 | return(0); | ||
48 | } | ||