Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixes EUCA-3962 where strncpy() is used instead of safe_strncpy(). Fixes

Coverity issue #11087.
  • Loading branch information...
commit 8eb3f2eba1f32462156a0650bd6168f0c4d19b80 1 parent e6e9119
gelinasc authored November 21, 2012

Showing 1 changed file with 8 additions and 8 deletions. Show diff stats Hide diff stats

  1. 16  node/NCclient.c
16  node/NCclient.c
@@ -152,17 +152,17 @@ int add_vbr (const char * spec_str, virtualMachine * vm_type)
152 152
     char * dev_spec = strtok (NULL, ":");
153 153
     char * loc_spec = strtok (NULL, ":");
154 154
     if (type_spec==NULL) { fprintf (stderr, "ERROR: invalid 'type' specification in VBR '%s'\n", spec_str); goto out_error; }
155  
-    strncpy (vbr->typeName, type_spec, sizeof (vbr->typeName));
  155
+    safe_strncpy (vbr->typeName, type_spec, sizeof (vbr->typeName));
156 156
     if (id_spec==NULL) { fprintf (stderr, "ERROR: invalid 'id' specification in VBR '%s'\n", spec_str); goto out_error; }
157  
-    strncpy (vbr->id, id_spec, sizeof (vbr->id));
  157
+    safe_strncpy (vbr->id, id_spec, sizeof (vbr->id));
158 158
     if (size_spec==NULL) { fprintf (stderr, "ERROR: invalid 'size' specification in VBR '%s'\n", spec_str); goto out_error; }
159 159
     vbr->size = atoi (size_spec);
160 160
     if (format_spec==NULL) { fprintf (stderr, "ERROR: invalid 'format' specification in VBR '%s'\n", spec_str); goto out_error; }
161  
-    strncpy (vbr->formatName, format_spec, sizeof (vbr->formatName));
  161
+    safe_strncpy (vbr->formatName, format_spec, sizeof (vbr->formatName));
162 162
     if (dev_spec==NULL) { fprintf (stderr, "ERROR: invalid 'guestDeviceName' specification in VBR '%s'\n", spec_str); goto out_error; }
163  
-    strncpy (vbr->guestDeviceName, dev_spec, sizeof (vbr->guestDeviceName));
  163
+    safe_strncpy (vbr->guestDeviceName, dev_spec, sizeof (vbr->guestDeviceName));
164 164
     if (loc_spec==NULL) { fprintf (stderr, "ERROR: invalid 'resourceLocation' specification in VBR '%s'\n", spec_str); goto out_error; }
165  
-    strncpy (vbr->resourceLocation, spec_str + (loc_spec - spec_copy), sizeof (vbr->resourceLocation));
  165
+    safe_strncpy (vbr->resourceLocation, spec_str + (loc_spec - spec_copy), sizeof (vbr->resourceLocation));
166 166
 
167 167
     free (spec_copy);
168 168
     return 0;
@@ -361,9 +361,9 @@ int main (int argc, char **argv)
361 361
     char walrus_url [BUFSIZE];
362 362
     snprintf (walrus_url, BUFSIZE, "http://%s%s", walrus_hostport, WALRUS_ENDPOINT);
363 363
     serviceInfoType * si = & (meta.services [meta.servicesLen++]);
364  
-    strncpy (si->type, "walrus", sizeof (si->type));
365  
-    strncpy (si->name, "walrus", sizeof (si->name));
366  
-    strncpy (si->uris[0], walrus_url, sizeof (si->uris[0]));
  364
+    safe_strncpy (si->type, "walrus", sizeof (si->type));
  365
+    safe_strncpy (si->name, "walrus", sizeof (si->name));
  366
+    safe_strncpy (si->uris[0], walrus_url, sizeof (si->uris[0]));
367 367
     si->urisLen = 1;
368 368
 
369 369
     if (use_wssec && !local) {

0 notes on commit 8eb3f2e

Please sign in to comment.
Something went wrong with that request. Please try again.