Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Update svm and vmx checkpoint functionality to new interface
[palacios.git] / palacios / src / palacios / vmm_string.c
index 725fa17..af102f7 100644 (file)
@@ -71,6 +71,11 @@ void * memcpy(void * dst, const void * src, size_t n) {
 #ifdef V3_CONFIG_BUILT_IN_MEMMOVE
 void * memmove(void * dst, const void * src, size_t n) {
     uint8_t * tmp = (uint8_t *)V3_Malloc(n);
+
+    if (!tmp) {
+       PrintError("Cannot allocate in built-in memmove\n");
+       return NULL;
+    }
     
     memcpy(tmp, src, n);
     memcpy(dst, tmp, n);
@@ -285,6 +290,12 @@ char * strdup(const char * s1) {
     char *ret;
 
     ret = V3_Malloc(strlen(s1) + 1);
+
+    if (!ret) {
+       PrintError("Cannot allocate in built-in strdup\n");
+       return NULL;
+    }
+
     strcpy(ret, s1);
 
     return ret;
@@ -460,10 +471,14 @@ size_t strcspn(const char * s, const char * reject) {
        for (i = 0; i < reject_len; i++) {
            if (s[cnt] == reject[i]) {
                match = 1;
-               cnt++;
                break;
            }
        }
+
+       if (!match) {
+           cnt++;
+       }
+
     }
 
     return cnt;