diff mbox

libio: Use wmemset instead of __wmemset to avoid linknamespace issue

Message ID 20160603074937.7543D405F6ED1@oldenburg.str.redhat.com
State New
Headers show

Commit Message

Florian Weimer June 3, 2016, 7:49 a.m. UTC
If the wide string operations are pulled into the link, the
wmemset symbol can cause a linknamespace failure.

2016-06-03  Florian Weimer  <fweimer@redhat.com>

	* libio/wstrops.c (_IO_wstr_overflow, enlarge_userbuf): Use
	__wmemset instead of wmemset.

Comments

Adhemerval Zanella Netto June 3, 2016, 1:42 p.m. UTC | #1
LGTM.

On 03/06/2016 04:49, Florian Weimer wrote:
> If the wide string operations are pulled into the link, the
> wmemset symbol can cause a linknamespace failure.
> 
> 2016-06-03  Florian Weimer  <fweimer@redhat.com>
> 
> 	* libio/wstrops.c (_IO_wstr_overflow, enlarge_userbuf): Use
> 	__wmemset instead of wmemset.
> 
> diff --git a/libio/wstrops.c b/libio/wstrops.c
> index 2b9d036..8d0e1cb 100644
> --- a/libio/wstrops.c
> +++ b/libio/wstrops.c
> @@ -111,7 +111,7 @@ _IO_wstr_overflow (_IO_FILE *fp, _IO_wint_t c)
>  	      fp->_wide_data->_IO_buf_base = NULL;
>  	    }
>  
> -	  wmemset (new_buf + old_wblen, L'\0', new_size - old_wblen);
> +	  __wmemset (new_buf + old_wblen, L'\0', new_size - old_wblen);
>  
>  	  _IO_wsetb (fp, new_buf, new_buf + new_size, 1);
>  	  fp->_wide_data->_IO_read_base =
> @@ -228,9 +228,9 @@ enlarge_userbuf (_IO_FILE *fp, _IO_off64_t offset, int reading)
>       new position.  */
>    assert (offset >= oldend);
>    if (reading)
> -    wmemset (wd->_IO_read_base + oldend, L'\0', offset - oldend);
> +    __wmemset (wd->_IO_read_base + oldend, L'\0', offset - oldend);
>    else
> -    wmemset (wd->_IO_write_base + oldend, L'\0', offset - oldend);
> +    __wmemset (wd->_IO_write_base + oldend, L'\0', offset - oldend);
>  
>    return 0;
>  }
>
Mike Frysinger June 3, 2016, 2:05 p.m. UTC | #2
On 03 Jun 2016 09:49, Florian Weimer wrote:
> If the wide string operations are pulled into the link, the
> wmemset symbol can cause a linknamespace failure.

looks obvious to me
-mike
diff mbox

Patch

diff --git a/libio/wstrops.c b/libio/wstrops.c
index 2b9d036..8d0e1cb 100644
--- a/libio/wstrops.c
+++ b/libio/wstrops.c
@@ -111,7 +111,7 @@  _IO_wstr_overflow (_IO_FILE *fp, _IO_wint_t c)
 	      fp->_wide_data->_IO_buf_base = NULL;
 	    }
 
-	  wmemset (new_buf + old_wblen, L'\0', new_size - old_wblen);
+	  __wmemset (new_buf + old_wblen, L'\0', new_size - old_wblen);
 
 	  _IO_wsetb (fp, new_buf, new_buf + new_size, 1);
 	  fp->_wide_data->_IO_read_base =
@@ -228,9 +228,9 @@  enlarge_userbuf (_IO_FILE *fp, _IO_off64_t offset, int reading)
      new position.  */
   assert (offset >= oldend);
   if (reading)
-    wmemset (wd->_IO_read_base + oldend, L'\0', offset - oldend);
+    __wmemset (wd->_IO_read_base + oldend, L'\0', offset - oldend);
   else
-    wmemset (wd->_IO_write_base + oldend, L'\0', offset - oldend);
+    __wmemset (wd->_IO_write_base + oldend, L'\0', offset - oldend);
 
   return 0;
 }