I have some code like this:
int main(){
    char *a = "2d6c002d61";
    char *b[strlen(a)];
    char *p;
    int count = 0;
    p = strtok(a,"00");
    while(p){
        unsigned char *c;
        char tar[100];
        hex_to_ascii(p,c);
        strncpy(tar,c,2);
        tar[2] = '\0';
        b[count]=tar;
        count++;
        p = strtok(NULL,"00");
    }
    b[count] = NULL;
    return 0;
}
The hex_to_ascii() will convert hex string to ascii string, for example, "2d6c" will be converted to "-l". I have checked this function and make sure it worked.
I hope to split a to "2d6c"  and  "2d61", then use hex_to_ascii() to convert them, and make b = {"-l","-a"}.
The problem is, although I got -l and make b = {"-l"} at first, it became {"-a","-a"} after that.
 
    