Ticket #13925: 0001-libroot-Fix-possible-typo-in-printf_size.c.patch

File 0001-libroot-Fix-possible-typo-in-printf_size.c.patch, 1.3 KB (added by ohnx56, 7 years ago)
  • src/system/libroot/posix/glibc/stdio-common/printf_size.c

    From 7724f6f10e16c4a2d9f317a6b9b57aeda64f8f78 Mon Sep 17 00:00:00 2001
    From: ohnx <me@masonx.ca>
    Date: Wed, 3 Jan 2018 17:10:10 +0000
    Subject: [PATCH] libroot: Fix possible typo in printf_size.c
    
    It appears as if there is a typo in printf_size.c; it makes
    no sense to compare an unitialized variable in such a way.
    Since `info->width` is referenced later on in the variable
    assignment, it seems possible that the intended statement
    was to place the larger of the values between `info->width`
    and `info->prec` into `width`.
    
    Fixes CID 609431.
    ---
     src/system/libroot/posix/glibc/stdio-common/printf_size.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/src/system/libroot/posix/glibc/stdio-common/printf_size.c b/src/system/libroot/posix/glibc/stdio-common/printf_size.c
    index db0f6d8f2a..9837356e62 100644
    a b printf_size (FILE *fp, const struct printf_info *info, const void *const *args)  
    183183
    184184  if (special)
    185185    {
    186       int width = info->prec > width ? info->prec : info->width;
     186      int width = info->prec > info->width ? info->prec : info->width;
    187187
    188188      if (negative || info->showsign || info->space)
    189189    --width;