Changeset 12275


Ignore:
Timestamp:
Mar 31, 2011, 4:24:57 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) fix "dangerous pointer arithmetic" warning detected by clang static analyzer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/bencode.c

    r12204 r12275  
    13991399                else {
    14001400                    const UTF8 * tmp = it;
    1401                     UTF32        buf = 0;
    1402                     UTF32 *      u32 = &buf;
    1403                     ConversionResult result = ConvertUTF8toUTF32( &tmp, end, &u32, &buf + 1, 0 );
     1401                    UTF32        buf[1] = { 0 };
     1402                    UTF32 *      u32 = buf;
     1403                    ConversionResult result = ConvertUTF8toUTF32( &tmp, end, &u32, buf + 1, 0 );
    14041404                    if((( result==conversionOK ) || (result==targetExhausted)) && (tmp!=it)) {
    1405                         outwalk += tr_snprintf( outwalk, outend-outwalk, "\\u%04x", (unsigned int)buf );
     1405                        outwalk += tr_snprintf( outwalk, outend-outwalk, "\\u%04x", (unsigned int)buf[0] );
    14061406                        it = tmp - 1;
    14071407                    }
Note: See TracChangeset for help on using the changeset viewer.