Brad Bishop | 0011132 | 2018-04-01 22:23:53 -0400 | [diff] [blame] | 1 | Upstream-Status: Backport |
| 2 | Signed-off-by: Ross Burton <ross.burton@intel.com> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 3 | |
Brad Bishop | 0011132 | 2018-04-01 22:23:53 -0400 | [diff] [blame] | 4 | From 5356b63005e9d8169e0399cb76f26fbd29a78dee Mon Sep 17 00:00:00 2001 |
| 5 | From: Joshua Kinard <kumba@gentoo.org> |
| 6 | Date: Wed, 23 Aug 2017 14:31:36 -0400 |
| 7 | Subject: [PATCH] Replace bzero() calls with equivalent memset() calls |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 8 | |
Brad Bishop | 0011132 | 2018-04-01 22:23:53 -0400 | [diff] [blame] | 9 | As annotated in the bzero(3) man page, bzero() was marked as LEGACY in |
| 10 | POSIX.1-2001 and removed in POSIX.1-2008, and should be replaced with |
| 11 | memset() calls to write zeros to a memory region. The attached patch |
| 12 | replaces two bzero() calls and one __bzero() call in libtirpc with |
| 13 | equivalent memset() calls. The latter replacement fixes a compile error |
| 14 | under uclibc-ng, which lacks a definition for __bzero() |
| 15 | |
| 16 | Signed-off-by: Joshua Kinard <kumba@gentoo.org> |
| 17 | Signed-off-by: Steve Dickson <steved@redhat.com> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 18 | --- |
Brad Bishop | 0011132 | 2018-04-01 22:23:53 -0400 | [diff] [blame] | 19 | src/auth_time.c | 2 +- |
| 20 | src/des_impl.c | 2 +- |
| 21 | src/svc_auth_des.c | 2 +- |
| 22 | 3 files changed, 3 insertions(+), 3 deletions(-) |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 23 | |
Brad Bishop | 0011132 | 2018-04-01 22:23:53 -0400 | [diff] [blame] | 24 | diff --git a/src/auth_time.c b/src/auth_time.c |
| 25 | index 7f83ab4..69400bc 100644 |
| 26 | --- a/src/auth_time.c |
| 27 | +++ b/src/auth_time.c |
| 28 | @@ -317,7 +317,7 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid) |
| 29 | sprintf(ipuaddr, "%d.%d.%d.%d.0.111", a1, a2, a3, a4); |
| 30 | useua = &ipuaddr[0]; |
| 31 | |
| 32 | - bzero((char *)&sin, sizeof(sin)); |
| 33 | + memset(&sin, 0, sizeof(sin)); |
| 34 | if (uaddr_to_sockaddr(useua, &sin)) { |
| 35 | msg("unable to translate uaddr to sockaddr."); |
| 36 | if (needfree) |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 37 | diff --git a/src/des_impl.c b/src/des_impl.c |
| 38 | index 9dbccaf..15bec2a 100644 |
| 39 | --- a/src/des_impl.c |
| 40 | +++ b/src/des_impl.c |
| 41 | @@ -588,7 +588,7 @@ _des_crypt (char *buf, unsigned len, struct desparams *desp) |
| 42 | } |
| 43 | tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; |
| 44 | tbuf[0] = tbuf[1] = 0; |
| 45 | - __bzero (schedule, sizeof (schedule)); |
| 46 | + memset (schedule, 0, sizeof (schedule)); |
| 47 | |
| 48 | return (1); |
| 49 | } |
Brad Bishop | 0011132 | 2018-04-01 22:23:53 -0400 | [diff] [blame] | 50 | diff --git a/src/svc_auth_des.c b/src/svc_auth_des.c |
| 51 | index 2e90146..19a7c60 100644 |
| 52 | --- a/src/svc_auth_des.c |
| 53 | +++ b/src/svc_auth_des.c |
| 54 | @@ -356,7 +356,7 @@ cache_init() |
| 55 | |
| 56 | authdes_cache = (struct cache_entry *) |
| 57 | mem_alloc(sizeof(struct cache_entry) * AUTHDES_CACHESZ); |
| 58 | - bzero((char *)authdes_cache, |
| 59 | + memset(authdes_cache, 0, |
| 60 | sizeof(struct cache_entry) * AUTHDES_CACHESZ); |
| 61 | |
| 62 | authdes_lru = (short *)mem_alloc(sizeof(short) * AUTHDES_CACHESZ); |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 63 | -- |
Brad Bishop | 0011132 | 2018-04-01 22:23:53 -0400 | [diff] [blame] | 64 | 1.8.3.1 |