Fossil

Check-in [5519c6b8]
Login

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

Overview
Comment:Fix the hextoblob() function so that does not report out-of-memory if the size of the input string is zero bytes. This fixes the instances of "out-of-memory" reports when accessing the /alerts page without an argument.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:5519c6b8fc5cee35adfb0648ec69866840b71336f254433ce74d638747ec31c7
User & Date: drh 2018-08-16 02:03:59
Context
2018-08-16
06:36
Replaced a declare-and-init line pair with a single define-with-value line. No functional change. check-in: 8f47c3f6 user: wyoung tags: trunk
02:03
Fix the hextoblob() function so that does not report out-of-memory if the size of the input string is zero bytes. This fixes the instances of "out-of-memory" reports when accessing the /alerts page without an argument. check-in: 5519c6b8 user: drh tags: trunk
01:46
Fixes to the /webmail screen check-in: a24de3f9 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/db.c.

966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
){
  const unsigned char *zIn = sqlite3_value_text(argv[0]);
  int nIn = sqlite3_value_bytes(argv[0]);
  unsigned char *zOut;
  if( zIn==0 ) return;
  if( nIn&1 ) return;
  if( !validate16((const char*)zIn, nIn) ) return;
  zOut = sqlite3_malloc64( nIn/2 );
  if( zOut==0 ){
    sqlite3_result_error_nomem(context);
    return;
  }
  decode16(zIn, zOut, nIn);
  sqlite3_result_blob(context, zOut, nIn/2, sqlite3_free);
}







|







966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
){
  const unsigned char *zIn = sqlite3_value_text(argv[0]);
  int nIn = sqlite3_value_bytes(argv[0]);
  unsigned char *zOut;
  if( zIn==0 ) return;
  if( nIn&1 ) return;
  if( !validate16((const char*)zIn, nIn) ) return;
  zOut = sqlite3_malloc64( nIn/2 + 1 );
  if( zOut==0 ){
    sqlite3_result_error_nomem(context);
    return;
  }
  decode16(zIn, zOut, nIn);
  sqlite3_result_blob(context, zOut, nIn/2, sqlite3_free);
}