1
1

tests: Fix pointer arithmetic in torture_pki_*_publickey_base64

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
Andreas Schneider 2018-10-01 19:23:52 +02:00
родитель 8c8026b892
Коммит 8c77a49729
4 изменённых файлов: 32 добавлений и 16 удалений

Просмотреть файл

@ -20,15 +20,19 @@ static int setup_rsa_key(void **state)
assert_true(b64_key != NULL); assert_true(b64_key != NULL);
q = p = b64_key; q = p = b64_key;
while (*p != ' ') p++; while (p != NULL && *p != '\0' && *p != ' ') p++;
*p = '\0'; if (p != NULL) {
*p = '\0';
}
type = ssh_key_type_from_name(q); type = ssh_key_type_from_name(q);
assert_true(type == SSH_KEYTYPE_RSA); assert_true(type == SSH_KEYTYPE_RSA);
q = ++p; q = ++p;
while (*p != ' ') p++; while (p != NULL && *p != '\0' && *p != ' ') p++;
*p = '\0'; if (p != NULL) {
*p = '\0';
}
rc = ssh_pki_import_pubkey_base64(q, type, &key); rc = ssh_pki_import_pubkey_base64(q, type, &key);
assert_true(rc == 0); assert_true(rc == 0);

Просмотреть файл

@ -199,15 +199,19 @@ static void torture_pki_ecdsa_publickey_base64(void **state)
assert_true(key_buf != NULL); assert_true(key_buf != NULL);
q = p = key_buf; q = p = key_buf;
while (*p != ' ') p++; while (p != NULL && *p != '\0' && *p != ' ') p++;
*p = '\0'; if (p != NULL) {
*p = '\0';
}
type = ssh_key_type_from_name(q); type = ssh_key_type_from_name(q);
assert_true(type == SSH_KEYTYPE_ECDSA); assert_true(type == SSH_KEYTYPE_ECDSA);
q = ++p; q = ++p;
while (*p != ' ') p++; while (p != NULL && *p != '\0' && *p != ' ') p++;
*p = '\0'; if (p != NULL) {
*p = '\0';
}
rc = ssh_pki_import_pubkey_base64(q, type, &key); rc = ssh_pki_import_pubkey_base64(q, type, &key);
assert_true(rc == 0); assert_true(rc == 0);

Просмотреть файл

@ -202,15 +202,19 @@ static void torture_pki_ed25519_publickey_base64(void **state)
assert_true(key_buf != NULL); assert_true(key_buf != NULL);
q = p = key_buf; q = p = key_buf;
while (*p != ' ') p++; while (p != NULL && *p != '\0' && *p != ' ') p++;
*p = '\0'; if (p != NULL) {
*p = '\0';
}
type = ssh_key_type_from_name(q); type = ssh_key_type_from_name(q);
assert_true(type == SSH_KEYTYPE_ED25519); assert_true(type == SSH_KEYTYPE_ED25519);
q = ++p; q = ++p;
while (*p != ' ') p++; while (p != NULL && *p != '\0' && *p != ' ') p++;
*p = '\0'; if (p != NULL) {
*p = '\0';
}
rc = ssh_pki_import_pubkey_base64(q, type, &key); rc = ssh_pki_import_pubkey_base64(q, type, &key);
assert_true(rc == 0); assert_true(rc == 0);

Просмотреть файл

@ -277,15 +277,19 @@ static void torture_pki_rsa_publickey_base64(void **state)
assert_true(key_buf != NULL); assert_true(key_buf != NULL);
q = p = key_buf; q = p = key_buf;
while (*p != ' ') p++; while (p != NULL && *p != '\0' && *p != ' ') p++;
*p = '\0'; if (p != NULL) {
*p = '\0';
}
type = ssh_key_type_from_name(q); type = ssh_key_type_from_name(q);
assert_true(type == SSH_KEYTYPE_RSA); assert_true(type == SSH_KEYTYPE_RSA);
q = ++p; q = ++p;
while (*p != ' ') p++; while (p != NULL && *p != '\0' && *p != ' ') p++;
*p = '\0'; if (p != NULL) {
*p = '\0';
}
rc = ssh_pki_import_pubkey_base64(q, type, &key); rc = ssh_pki_import_pubkey_base64(q, type, &key);
assert_true(rc == 0); assert_true(rc == 0);