Found and fixed evil memory corruption error.

This commit is contained in:
gardners 2012-01-09 05:10:58 +10:30
parent ba645687f6
commit e069984c71

View File

@ -1455,6 +1455,7 @@ int overlay_rhizome_add_advertisements(int interface_number,overlay_buffer *e)
WHY("Couldn't open blob"); WHY("Couldn't open blob");
continue; continue;
} }
ob_makespace(e,RHIZOME_BAR_BYTES);
if (sqlite3_blob_read(blob,&e->bytes[e->length],RHIZOME_BAR_BYTES,0) if (sqlite3_blob_read(blob,&e->bytes[e->length],RHIZOME_BAR_BYTES,0)
!=SQLITE_OK) { !=SQLITE_OK) {
WHY("Couldn't read from blob"); WHY("Couldn't read from blob");
@ -1462,12 +1463,15 @@ int overlay_rhizome_add_advertisements(int interface_number,overlay_buffer *e)
continue; continue;
} }
e->length+=RHIZOME_BAR_BYTES; e->length+=RHIZOME_BAR_BYTES;
slots_used++;
sqlite3_blob_close(blob); sqlite3_blob_close(blob);
} }
} }
if (debug>1) printf("Appended %d rhizome advertisements to packet.\n",slots_used);
e->bytes[rfs_offset]=1+1+1+8*slots_used; e->bytes[rfs_offset]=1+1+1+8*slots_used;
sqlite3_finalize(statement);
return 0; return 0;
} }