Fossil

Check-in [8707e869]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make sure fossil_strndup() always adds a zero terminator.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8707e869496705cd4d1ed7f23d23441b59b2949999f49cf3034c4cb007ba28d1
User & Date: drh 2017-06-08 12:50:34.235
Context
2017-06-08
15:03
Update the built-in SQLite to version 3.19.3. ... (check-in: 5a6f9467 user: drh tags: trunk)
12:50
Make sure fossil_strndup() always adds a zero terminator. ... (check-in: 8707e869 user: drh tags: trunk)
2017-06-07
15:55
Fix the "fossil sha3sum" command so that it accepts "-" to mean stdin. Clarify the algorithm used. ... (check-in: 86fa03ad user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/import.c.
83
84
85
86
87
88
89
90

91
92
93
94
95
96
97
    int n;
    if( len<0 ){
      n = strlen(zOrig);
    }else{
      for( n=0; zOrig[n] && n<len; ++n );
    }
    z = fossil_malloc( n+1 );
    memcpy(z, zOrig, n+1);

  }
  return z;
}
char *fossil_strdup(const char *zOrig){
  return fossil_strndup(zOrig, -1);
}








|
>







83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
    int n;
    if( len<0 ){
      n = strlen(zOrig);
    }else{
      for( n=0; zOrig[n] && n<len; ++n );
    }
    z = fossil_malloc( n+1 );
    memcpy(z, zOrig, n);
    z[n] = 0;
  }
  return z;
}
char *fossil_strdup(const char *zOrig){
  return fossil_strndup(zOrig, -1);
}