The branch, v4-3-test has been updated
       via  a23461d lib: replace: snprintf - Fix length calculation for 
hex/octal 64-bit values.
      from  136ed0e samba-too: Allow 'samba-tool fsmo' to cope with empty or 
missing fsmo roles

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-3-test


- Log -----------------------------------------------------------------
commit a23461d2ece8cc46d3888f83a75847a7ea1736f0
Author: Lorinczy Zsigmond <[email protected]>
Date:   Thu Jun 2 14:54:05 2016 -0700

    lib: replace: snprintf - Fix length calculation for hex/octal 64-bit values.
    
    Prevents truncation due to buffer size being too small.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11947
    
    Signed-off-by: Lorinczy Zsigmond <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    Reviewed-by: Michael Adam <[email protected]>
    
    Autobuild-User(master): Michael Adam <[email protected]>
    Autobuild-Date(master): Fri Jun  3 03:48:58 CEST 2016 on sn-devel-144
    
    (cherry picked from commit 8814b2556583e1f8965e8bf5a93438d46e8d43e6)
    
    Autobuild-User(v4-3-test): Karolin Seeger <[email protected]>
    Autobuild-Date(v4-3-test): Thu Jun  9 16:30:22 CEST 2016 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 lib/replace/snprintf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/replace/snprintf.c b/lib/replace/snprintf.c
index 86ba74c..63eb036 100644
--- a/lib/replace/snprintf.c
+++ b/lib/replace/snprintf.c
@@ -804,7 +804,7 @@ static void fmtint(char *buffer, size_t *currlen, size_t 
maxlen,
 {
        int signvalue = 0;
        unsigned LLONG uvalue;
-       char convert[20];
+       char convert[22+1]; /* 64-bit value in octal: 22 digits + \0 */
        int place = 0;
        int spadlen = 0; /* amount to space pad */
        int zpadlen = 0; /* amount to zero pad */
@@ -834,8 +834,8 @@ static void fmtint(char *buffer, size_t *currlen, size_t 
maxlen,
                        (caps? "0123456789ABCDEF":"0123456789abcdef")
                        [uvalue % (unsigned)base  ];
                uvalue = (uvalue / (unsigned)base );
-       } while(uvalue && (place < 20));
-       if (place == 20) place--;
+       } while(uvalue && (place < sizeof(convert)));
+       if (place == sizeof(convert)) place--;
        convert[place] = 0;
 
        zpadlen = max - place;


-- 
Samba Shared Repository

Reply via email to