Changeset 5697


Ignore:
Timestamp:
Nov 17, 2017 4:07:43 AM (6 years ago)
Author:
ming
Message:

Re #2063: Add more doc in other parts of the library

Location:
pjproject/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib-util/include/pjlib-util/cli.h

    r4537 r5697  
    401401 * register it to the CLI application. 
    402402 * 
     403 * Note that the input string MUST be NULL terminated. 
     404 * 
    403405 * @param cli           The CLI application. 
    404406 * @param group         Optional group to which this command will be added 
     
    406408 *                      command. 
    407409 * @param xml           Input string containing XML node text for the 
    408  *                      command. 
     410 *                      command, MUST be NULL terminated. 
    409411 * @param handler       Function handler for the command. This must be NULL 
    410412 *                      if the command specifies a command group. 
  • pjproject/trunk/pjlib-util/include/pjlib-util/xml.h

    r3553 r5697  
    7474 * be included in the resulted XML node tree. 
    7575 * 
     76 * Note that the XML message input buffer MUST be NULL terminated and have 
     77 * length at least len+1 (len MUST NOT include the NULL terminator). 
     78 * 
    7679 * @param pool      Pool to allocate memory from. 
    77  * @param msg       The XML message to parse. 
    78  * @param len       The length of the message. 
     80 * @param msg       The XML message to parse, MUST be NULL terminated. 
     81 * @param len       The length of the message, not including NULL terminator. 
    7982 * 
    8083 * @return          XML root node, or NULL if the XML document can not be parsed. 
  • pjproject/trunk/pjlib-util/src/pjlib-util/cli.c

    r4825 r5697  
    695695            PJ_USE_EXCEPTION; 
    696696 
     697            /* The buffer passed to the scanner is not NULL terminated, 
     698             * but should be safe. See ticket #2063. 
     699             */ 
    697700            pj_scan_init(&scanner, attr->value.ptr, attr->value.slen, 
    698701                         PJ_SCAN_AUTOSKIP_WS, &on_syntax_error); 
     
    723726            } 
    724727            PJ_END; 
    725              
     728 
     729            pj_scan_fini(&scanner); 
     730 
    726731        } else if (!pj_stricmp2(&attr->name, "desc")) { 
    727732            pj_strdup(cli->pool, &cmd->desc, &attr->value); 
     
    861866    pj_cli_exec_info_default(info); 
    862867 
    863     /* Set the parse mode based on the latest char. */ 
     868    /* Set the parse mode based on the latest char. 
     869     * And NULL terminate the buffer for the scanner. 
     870     */ 
    864871    len = pj_ansi_strlen(cmdline); 
    865872    if (len > 0 && ((cmdline[len - 1] == '\r')||(cmdline[len - 1] == '\n'))) { 
     
    931938        } 
    932939        PJ_END; 
     940         
     941        pj_scan_fini(&scanner); 
    933942    }  
    934943     
  • pjproject/trunk/pjlib-util/src/pjlib-util/cli_telnet.c

    r5647 r5697  
    972972    } 
    973973    PJ_END; 
     974     
     975    pj_scan_fini(&scanner); 
    974976    return PJ_SUCCESS; 
    975977} 
     
    13331335    PJ_END; 
    13341336 
     1337    pj_scan_fini(&scanner); 
    13351338    return PJ_SUCCESS; 
    13361339} 
  • pjproject/trunk/pjlib-util/src/pjlib-util/scanner.c

    r5695 r5697  
    128128    scanner->skip_ws = options; 
    129129 
    130     /* Buffer validation. Must be NULL terminated. 
    131      * See ticket #2063. 
    132      */ 
    133     // pj_assert(*(scanner->end) == 0); 
    134  
    135130    if (scanner->skip_ws)  
    136131        pj_scan_skip_whitespace(scanner); 
  • pjproject/trunk/pjmedia/include/pjmedia/sdp.h

    r4367 r5697  
    646646 * Parse SDP message. 
    647647 * 
     648 * Note that the input message buffer MUST be NULL terminated and have 
     649 * length at least len+1 (len MUST NOT include the NULL terminator). 
     650 * 
    648651 * @param pool      The pool to allocate SDP session description. 
    649  * @param buf       The message buffer. 
    650  * @param len       The length of the message. 
     652 * @param buf       The message buffer, MUST be NULL terminated. 
     653 * @param len       The length of the message, excluding NULL terminator. 
    651654 * @param p_sdp     Pointer to receive the SDP session descriptor. 
    652655 * 
  • pjproject/trunk/pjmedia/src/pjmedia/sdp.c

    r5335 r5697  
    276276    } 
    277277 
     278    /* The buffer passed to the scanner is not guaranteed to be NULL 
     279     * terminated, but should be safe. See ticket #2063. 
     280     */     
    278281    pj_scan_init(&scanner, (char*)attr->value.ptr, attr->value.slen, 
    279282                 PJ_SCAN_AUTOSKIP_WS, &on_scanner_error); 
     
    386389     */ 
    387390 
     391    /* The buffer passed to the scanner is not guaranteed to be NULL 
     392     * terminated, but should be safe. See ticket #2063. 
     393     */ 
    388394    pj_scan_init(&scanner, (char*)attr->value.ptr, attr->value.slen, 
    389395                 PJ_SCAN_AUTOSKIP_WS, &on_scanner_error); 
  • pjproject/trunk/pjsip/include/pjsip-simple/iscomposing.h

    r3553 r5697  
    105105 * message. 
    106106 * 
     107 * Note that the input string buffer MUST be NULL terminated and have 
     108 * length at least len+1 (len MUST NOT include the NULL terminator). 
     109 * 
    107110 * @param pool              Pool to allocate memory for the parsing process. 
    108  * @param msg               The message to be parsed. 
    109  * @param len               Length of the message. 
     111 * @param msg               The message to be parsed, MUST be NULL terminated. 
     112 * @param len               Length of the message, excluding NULL terminator. 
    110113 * @param p_is_composing    Optional pointer to receive iscomposing status. 
    111114 * @param p_last_active     Optional pointer to receive last active attribute. 
  • pjproject/trunk/pjsip/include/pjsip-simple/xpidf.h

    r3553 r5697  
    6161 * Parse XPIDF document. 
    6262 * 
     63 * Note that the input text buffer MUST be NULL terminated and have 
     64 * length at least len+1 (len MUST NOT include the NULL terminator). 
     65 * 
    6366 * @param pool      Pool. 
    64  * @param text      Input text. 
    65  * @param len       Length of input text. 
     67 * @param text      Input text, MUST be NULL terminated. 
     68 * @param len       Length of input text, NOT including the NULL terminator. 
    6669 * 
    6770 * @return          XPIDF document. 
  • pjproject/trunk/pjsip/include/pjsip/sip_parser.h

    r5693 r5697  
    280280 * Check incoming packet to see if a (probably) valid SIP message has been  
    281281 * received. 
    282  * Note that the input string buffer MUST be NULL terminated. 
     282 * Note that the input string buffer MUST be NULL terminated and have 
     283 * length at least size+1 (size MUST NOT include the NULL terminator). 
    283284 * 
    284285 * @param buf           The input buffer, which must be NULL terminated. 
    285  * @param size          The buffer size. 
     286 * @param size          The length of the string (not counting NULL terminator). 
    286287 * @param is_datagram   Put non-zero if transport is datagram oriented. 
    287288 * @param msg_size      [out] If message is valid, this parameter will contain 
  • pjproject/trunk/pjsip/src/pjsip/sip_parser.c

    r5694 r5697  
    878878            PJ_USE_EXCEPTION; 
    879879 
     880            /* The buffer passed to the scanner is not NULL terminated, 
     881             * but should be safe. See ticket #2063. 
     882             */  
    880883            pj_scan_init(&scanner, (char*)line, hdr_end-line,  
    881884                         PJ_SCAN_AUTOSKIP_WS_HEADER, &on_syntax_error); 
Note: See TracChangeset for help on using the changeset viewer.