When exporting visit records, if there is corrupt (non-printable) data in seen/answer...
authorArt Cancro <ajc@citadel.org>
Mon, 24 Jul 2023 15:09:18 +0000 (06:09 -0900)
committerArt Cancro <ajc@citadel.org>
Mon, 24 Jul 2023 15:09:18 +0000 (06:09 -0900)
citadel/utils/ctdldump.c

index a26914091bcfb830c9a475d0bb5e1eb594db1aa5..b5a6085d80bf358988209617db382011ce646056 100644 (file)
@@ -246,6 +246,25 @@ void export_msglist(int which_cdb, DBT *in_key, DBT *in_data) {
 // export function for a visit record
 void export_visit(int which_cdb, DBT *in_key, DBT *in_data) {
        struct visit *visit = (struct visit *)in_data->data;
+       int i, len;
+
+       // If there is corrupt data in the "seen" array, cut that out before exporting
+       len = strlen(visit->v_seen);
+       for (i=0; i<len; ++i) {
+               if (!isprint(visit->v_seen[i])) {
+                       visit->v_seen[i] = 0;
+               }
+       }
+
+       // If there is corrupt data in the "answered" array, cut that out before exporting
+       len = strlen(visit->v_answered);
+       for (i=0; i<len; ++i) {
+               if (!isprint(visit->v_answered[i])) {
+                       visit->v_answered[i] = 0;
+               }
+       }
+
+       // output the record
        printf("visit|%ld|%ld|%ld|%ld|%u|%s|%s|%d|\n",
                visit->v_roomnum,
                visit->v_roomgen,