Loadrunner 8.0 二维指针运行报错问题

在Loadrunner 8.0 VU脚本编写时如脚本中包含了二维指针,则报如下错误:
Error: An exception was raised while calling invocation function in interpreter extension cciext.dll: System Exceptions: EXCEPTION_ACCESS_VIOLATION.
如下代码:
#include "web_api.h"

int escape_url_character(char *data, int data_len)
{
  
    char  * transfer_table[][2] = {
        {"+", "2B"}, {"[","5B"},{"]","5D"},{"`","60"},
        {";","3B"},{"/","2F"},{"?","3F"},{":","3A"},
        {"@","40"},{"=","3D"},{"&","26"},{"$","24"},
        {" ","20"},{"","3E"},{"#","23"},
        {"%","25"},{"{","7B"},{"}","7D"},{"|","7C"},
        {"\\","5C"},{"^","5E"},{"~","7E"}, {NULL, NULL} };

    int i = 0, j;
    char *buf = (char*) calloc(data_len + 1, sizeof(char));

    while( i < data_len ){
        if( '%' != data[i]){
            strncat(buf, data+i, 1);
            i++;
            continue;
        }

 
        j = 0;
        while( NULL != transfer_table[j][1] ){
            if( 0 == strncmp(data+i+1, transfer_table[j][1], 2 )){
                strncat(buf, transfer_table[j][0], 1);
                i += 3;
                break;
            }
            j++;
        }
    
        if( NULL == transfer_table[j][1] ){
            strncat(buf, data+i, 1);
           /* printf("escape_url_character: unhandled sequence: %s\n", data+i);*/
            i++;
        }
    }

    memset(data, 0, data_len);
    strcpy(data, buf);

    free(buf);
    return 0;
}
Action()
{

    return 0;
}


此种情况下将二维指针改为三维数组就能运行通过,即上面代码char  * transfer_table[][2] 改为char transfer_table[24][2][3]就能运行通过了。
这也许是LoadRunner的一个bug

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/20652124/viewspace-664107/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/20652124/viewspace-664107/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值