align_offset() adjusted pointer to wrong location. oops.
authorLuke Leighton <lkcl@samba.org>
Mon, 13 Oct 1997 11:15:46 +0000 (11:15 +0000)
committerLuke Leighton <lkcl@samba.org>
Mon, 13 Oct 1997 11:15:46 +0000 (11:15 +0000)
(This used to be commit ba28678e3f673cd10d936f59ff0df6a852aca793)

source3/lib/util.c

index a68b8c2e6c1935c4c4dab176f04c1a0b2be656e2..0a8540b48b4cbe722ddee8a11ae479a3bfb937e5 100644 (file)
@@ -4383,9 +4383,10 @@ will work for offsets of 0, 2 and 4...
 ********************************************************************/
 char *align_offset(char *q, char *base, int align_offset_len)
 {
-       if (align_offset_len != 0 && ((q - base) & (align_offset_len-1)))
+       int mod = ((q - base) & (align_offset_len-1));
+       if (align_offset_len != 0 && mod != 0)
        {
-               q += align_offset_len - ((q - base) & (align_offset_len));
+               q += align_offset_len - mod;
        }
        return q;
 }