Add patch to make unalignment test really unaligned
This commit is contained in:
		
							parent
							
								
									8d4af9f9e5
								
							
						
					
					
						commit
						f8a50b8a98
					
				
							
								
								
									
										47
									
								
								libxcrypt-4.4.5-make_unalignment_test_really_unaligned.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								libxcrypt-4.4.5-make_unalignment_test_really_unaligned.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,47 @@ | |||||||
|  | From 9b2e9bd79cb91f50dd713899544423808f932b09 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Vitaly Chikunov <vt@altlinux.org> | ||||||
|  | Date: Sat, 4 May 2019 21:19:06 +0300 | ||||||
|  | Subject: [PATCH] crypt-kat: Make unalignment test really unaligned. | ||||||
|  | 
 | ||||||
|  | As noted and suggested by Solar. | ||||||
|  | ---
 | ||||||
|  |  test/crypt-kat.c | 13 ++++++++----- | ||||||
|  |  1 file changed, 8 insertions(+), 5 deletions(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/test/crypt-kat.c b/test/crypt-kat.c
 | ||||||
|  | index 4402e24..19a79b1 100644
 | ||||||
|  | --- a/test/crypt-kat.c
 | ||||||
|  | +++ b/test/crypt-kat.c
 | ||||||
|  | @@ -200,24 +200,27 @@ static void *
 | ||||||
|  |  calc_hashes_crypt_r_rn (ARG_UNUSED (void *unused)) | ||||||
|  |  { | ||||||
|  |    char *hash; | ||||||
|  | -  char pass[CRYPT_MAX_PASSPHRASE_SIZE];
 | ||||||
|  | +  union {
 | ||||||
|  | +      char pass[CRYPT_MAX_PASSPHRASE_SIZE + 1];
 | ||||||
|  | +      int aligned;
 | ||||||
|  | +  } u;
 | ||||||
|  |    size_t i; | ||||||
|  |    struct crypt_data data; | ||||||
|  |    int status = 0; | ||||||
|  |   | ||||||
|  |    memset (&data, 0, sizeof data); | ||||||
|  | -  memset (pass, 0, CRYPT_MAX_PASSPHRASE_SIZE);
 | ||||||
|  | +  memset (u.pass, 0, CRYPT_MAX_PASSPHRASE_SIZE + 1);
 | ||||||
|  |    for (i = 0; i < ntests; i++) | ||||||
|  |      { | ||||||
|  | -      strncpy(pass + 1, tests[i].input, CRYPT_MAX_PASSPHRASE_SIZE - 1);
 | ||||||
|  | +      strncpy(u.pass + 1, tests[i].input, CRYPT_MAX_PASSPHRASE_SIZE);
 | ||||||
|  |        printf("[%d]: %s %s\n", strlen(tests[i].input), tests[i].input, tests[i].salt); | ||||||
|  |        errno = 0; | ||||||
|  | -      hash = crypt_r (pass + 1, tests[i].salt, &data);
 | ||||||
|  | +      hash = crypt_r (u.pass + 1, tests[i].salt, &data);
 | ||||||
|  |        status |= report_result ("crypt_r", hash, errno, &tests[i], | ||||||
|  |                                 ENABLE_FAILURE_TOKENS); | ||||||
|  |   | ||||||
|  |        errno = 0; | ||||||
|  | -      hash = crypt_rn (pass + 1, tests[i].salt, &data, (int)sizeof data);
 | ||||||
|  | +      hash = crypt_rn (u.pass + 1, tests[i].salt, &data, (int)sizeof data);
 | ||||||
|  |        status |= report_result ("crypt_rn", hash, errno, &tests[i], false); | ||||||
|  |      } | ||||||
|  |   | ||||||
| @ -153,6 +153,7 @@ Source0:        %{url}/archive/v%{version}/%{name}-%{version}.tar.gz | |||||||
| 
 | 
 | ||||||
| # Patch 0000 - 2999: Backported patches from upstream. | # Patch 0000 - 2999: Backported patches from upstream. | ||||||
| Patch0000:      %{url}/commit/5cce1ebe4e8e303bab593af694c9d30c51cf5eb4.patch#/%{name}-4.4.5-remove_unneeded_union_keyword.patch | Patch0000:      %{url}/commit/5cce1ebe4e8e303bab593af694c9d30c51cf5eb4.patch#/%{name}-4.4.5-remove_unneeded_union_keyword.patch | ||||||
|  | Patch0001:      %{url}/commit/9b2e9bd79cb91f50dd713899544423808f932b09.patch#/%{name}-4.4.5-make_unalignment_test_really_unaligned.patch | ||||||
| 
 | 
 | ||||||
| # Patch 3000 - 5999: Backported patches from pull requests. | # Patch 3000 - 5999: Backported patches from pull requests. | ||||||
| 
 | 
 | ||||||
| @ -463,6 +464,7 @@ done | |||||||
| * Sat May 04 2019 Björn Esser <besser82@fedoraproject.org> - 4.4.5-1 | * Sat May 04 2019 Björn Esser <besser82@fedoraproject.org> - 4.4.5-1 | ||||||
| - New upstream release (#1706419) | - New upstream release (#1706419) | ||||||
| - Add patch to remove an unneeded union keyword | - Add patch to remove an unneeded union keyword | ||||||
|  | - Add patch to make unalignment test really unaligned | ||||||
| 
 | 
 | ||||||
| * Fri Mar 15 2019 Björn Esser <besser82@fedoraproject.org> - 4.4.4-2 | * Fri Mar 15 2019 Björn Esser <besser82@fedoraproject.org> - 4.4.4-2 | ||||||
| - Change Recommends: whois-mkpasswd to Fedora 30 and later (#1687870) | - Change Recommends: whois-mkpasswd to Fedora 30 and later (#1687870) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user