~ubuntu-branches/debian/sid/flickcurl/sid

« back to all changes in this revision

Viewing changes to src/args.c

  • Committer: Package Import Robot
  • Author(s): Kumar Appaiah
  • Date: 2013-05-20 21:15:09 UTC
  • mfrom: (1.4.1) (15.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130520211509-e701o5dlwa04aqiw
Tags: 1.24-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
    for(attr = node->properties; attr; attr = attr->next) {
91
91
      const char *attr_name = (const char*)attr->name;
92
92
      if(!strcmp(attr_name, "name")) {
93
 
        arg->name = (char*)malloc(strlen((const char*)attr->children->content)+1);
94
 
        strcpy(arg->name, (const char*)attr->children->content);
 
93
        size_t len = strlen((const char*)attr->children->content);
 
94
        arg->name = (char*)malloc(len + 1);
 
95
        memcpy(arg->name, attr->children->content, len + 1);
95
96
      } else if(!strcmp(attr_name, "optional"))
96
97
        arg->optional = atoi((const char*)attr->children->content);
97
98
    }
99
100
    /* Walk children nodes for description text */
100
101
    for(chnode = node->children; chnode; chnode = chnode->next) {
101
102
      if(chnode->type == XML_TEXT_NODE) {
102
 
        arg->description = (char*)malloc(strlen((const char*)chnode->content)+1);
103
 
        strcpy(arg->description, (const char*)chnode->content);
 
103
        size_t len = strlen((const char*)chnode->content);
 
104
        arg->description = (char*)malloc(len + 1);
 
105
        memcpy(arg->description, (const char*)chnode->content, len + 1);
104
106
        break;
105
107
      }
106
108
    }