فهرست منبع

db_postgres: safety check to see if hasing is over non-null pointer

- inside implementation of replace command
Daniel-Constantin Mierla 10 سال پیش
والد
کامیت
9cd4aef84d
1فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 4 4
      modules/db_postgres/km_dbase.c

+ 4 - 4
modules/db_postgres/km_dbase.c

@@ -905,12 +905,12 @@ int db_postgres_replace(const db1_con_t* _h, const db_key_t* _k,
 						pos += VAL_UINT(&_v[i]);
 						break;
 					case DB1_STR:
-						pos += get_hash1_raw((VAL_STR(&_v[i])).s,
-									(VAL_STR(&_v[i])).len);
+						pos += ((VAL_STR(&_v[i])).s)?get_hash1_raw((VAL_STR(&_v[i])).s,
+									(VAL_STR(&_v[i])).len):0;
 						break;
 					case DB1_STRING:
-						pos += get_hash1_raw(VAL_STRING(&_v[i]),
-									strlen(VAL_STRING(&_v[i])));
+						pos += (VAL_STRING(&_v[i]))?get_hash1_raw(VAL_STRING(&_v[i]),
+									strlen(VAL_STRING(&_v[i]))):0;
 						break;
 					default:
 						break;