manual: cuserid is mtasurace if not passed a string

Message ID ory4rn8lt9.fsf@free.home
State Committed
Headers

Commit Message

Alexandre Oliva Nov. 7, 2014, 8:19 a.m. UTC
  During the MTASC-Safety code review, in my analysis of cuserid, I failed
to notice the use of the static buffer in case a buffer is not passed as
an argument.  Oops.  This patch fixes the error.  Ok to install?


From: Alexandre Oliva <aoliva@redhat.com>

for  ChangeLog

	* manual/users.texi (cuserid): Fix MT-Safety note for the case
	of not passing it a buffer.
	Reported by Peng Haitao.
---
 manual/users.texi |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Alexandre Oliva Nov. 19, 2014, 7:59 p.m. UTC | #1
On Nov  7, 2014, Alexandre Oliva <aoliva@redhat.com> wrote:

> During the MTASC-Safety code review, in my analysis of cuserid, I failed
> to notice the use of the static buffer in case a buffer is not passed as
> an argument.  Oops.  This patch fixes the error.  Ok to install?

Ping?  I supose this is trivial enough that I could check it in without
a review by a third party, but I'll wait a couple more days just in
case.

> From: Alexandre Oliva <aoliva@redhat.com>

> for  ChangeLog

> 	* manual/users.texi (cuserid): Fix MT-Safety note for the case
> 	of not passing it a buffer.
> 	Reported by Peng Haitao.
> ---
>  manual/users.texi |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

> diff --git a/manual/users.texi b/manual/users.texi
> index a14a256..e8f0f3b 100644
> --- a/manual/users.texi
> +++ b/manual/users.texi
> @@ -927,8 +927,9 @@ this function or to @code{cuserid}.
>  @comment stdio.h
>  @comment POSIX.1
>  @deftypefun {char *} cuserid (char *@var{string})
> -@safety{@prelim{}@mtsafe{@mtslocale{}}@asunsafe{@ascudlopen{} @ascuplugin{} @ascuheap{} @asulock{}}@acunsafe{@acucorrupt{} @aculock{} @acsfd{} @acsmem{}}}
> -@c cuserid @mtslocale @ascudlopen @ascuplugin @ascuheap @asulock @acucorrupt @aculock @acsfd @acsmem
> +@safety{@prelim{}@mtunsafe{@mtasurace{:cuserid/!string} @mtslocale{}}@asunsafe{@ascudlopen{} @ascuplugin{} @ascuheap{} @asulock{}}@acunsafe{@acucorrupt{} @aculock{} @acsfd{} @acsmem{}}}
> +@c cuserid @mtasurace:cuserid/!string @mtslocale @ascudlopen @ascuplugin @ascuheap @asulock @acucorrupt @aculock @acsfd @acsmem
> +@c   if string is NULL, cuserid will overwrite and return a static buffer
>  @c  geteuid dup ok
>  @c  getpwuid_r dup @mtslocale @ascudlopen @ascuplugin @ascuheap @asulock @acucorrupt @aculock @acsfd @acsmem
>  @c  strncpy dup ok
  
Carlos O'Donell Nov. 19, 2014, 9:45 p.m. UTC | #2
On 11/07/2014 03:19 AM, Alexandre Oliva wrote:
> During the MTASC-Safety code review, in my analysis of cuserid, I failed
> to notice the use of the static buffer in case a buffer is not passed as
> an argument.  Oops.  This patch fixes the error.  Ok to install?

I'm happy to see this getting continued maintenance and review. Thanks for
doing this! I think that if a patch, like that for ctermid, is ACK'd that
the manual changes should be automatically OK. In this case for cuserid
I do think it's useful to have a review.

> From: Alexandre Oliva <aoliva@redhat.com>
> 
> for  ChangeLog
> 
> 	* manual/users.texi (cuserid): Fix MT-Safety note for the case
> 	of not passing it a buffer.
> 	Reported by Peng Haitao.
> ---
>  manual/users.texi |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/manual/users.texi b/manual/users.texi
> index a14a256..e8f0f3b 100644
> --- a/manual/users.texi
> +++ b/manual/users.texi
> @@ -927,8 +927,9 @@ this function or to @code{cuserid}.
>  @comment stdio.h
>  @comment POSIX.1
>  @deftypefun {char *} cuserid (char *@var{string})
> -@safety{@prelim{}@mtsafe{@mtslocale{}}@asunsafe{@ascudlopen{} @ascuplugin{} @ascuheap{} @asulock{}}@acunsafe{@acucorrupt{} @aculock{} @acsfd{} @acsmem{}}}
> -@c cuserid @mtslocale @ascudlopen @ascuplugin @ascuheap @asulock @acucorrupt @aculock @acsfd @acsmem
> +@safety{@prelim{}@mtunsafe{@mtasurace{:cuserid/!string} @mtslocale{}}@asunsafe{@ascudlopen{} @ascuplugin{} @ascuheap{} @asulock{}}@acunsafe{@acucorrupt{} @aculock{} @acsfd{} @acsmem{}}}

Do we document what `!string` means?

Doesn't this violate the description for `race` which says it
is a colon followed by the argument name?

Doesn't the above produce "MT-Unsafe race:cuserid/!string"?

> +@c cuserid @mtasurace:cuserid/!string @mtslocale @ascudlopen @ascuplugin @ascuheap @asulock @acucorrupt @aculock @acsfd @acsmem
> +@c   if string is NULL, cuserid will overwrite and return a static buffer
>  @c  geteuid dup ok
>  @c  getpwuid_r dup @mtslocale @ascudlopen @ascuplugin @ascuheap @asulock @acucorrupt @aculock @acsfd @acsmem
>  @c  strncpy dup ok
> 
> 

Cheers,
Carlos.
  

Patch

diff --git a/manual/users.texi b/manual/users.texi
index a14a256..e8f0f3b 100644
--- a/manual/users.texi
+++ b/manual/users.texi
@@ -927,8 +927,9 @@  this function or to @code{cuserid}.
 @comment stdio.h
 @comment POSIX.1
 @deftypefun {char *} cuserid (char *@var{string})
-@safety{@prelim{}@mtsafe{@mtslocale{}}@asunsafe{@ascudlopen{} @ascuplugin{} @ascuheap{} @asulock{}}@acunsafe{@acucorrupt{} @aculock{} @acsfd{} @acsmem{}}}
-@c cuserid @mtslocale @ascudlopen @ascuplugin @ascuheap @asulock @acucorrupt @aculock @acsfd @acsmem
+@safety{@prelim{}@mtunsafe{@mtasurace{:cuserid/!string} @mtslocale{}}@asunsafe{@ascudlopen{} @ascuplugin{} @ascuheap{} @asulock{}}@acunsafe{@acucorrupt{} @aculock{} @acsfd{} @acsmem{}}}
+@c cuserid @mtasurace:cuserid/!string @mtslocale @ascudlopen @ascuplugin @ascuheap @asulock @acucorrupt @aculock @acsfd @acsmem
+@c   if string is NULL, cuserid will overwrite and return a static buffer
 @c  geteuid dup ok
 @c  getpwuid_r dup @mtslocale @ascudlopen @ascuplugin @ascuheap @asulock @acucorrupt @aculock @acsfd @acsmem
 @c  strncpy dup ok