Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] Update of db_gdbm module – strict zsfree() usage, better main #ifdef



Hello,
when unmetafied string is returned, possibly containing nulls, zsfree() cannot be used. There is probably a better way to solve this, but following method for sure works:

         /* Free key, restoring its original length */
+        set_length(umkey, umlen);
         zsfree(umkey);

+static void set_length(char *buf, int size) {
+    buf[size]='\0';
+    while ( -- size >= 0 ) {
+        buf[size]=' ';
+    }
+}

Attached is a patch, tested with TESTNUM=V11. Would be nice if also 40898 would be applied: http://www.zsh.org/mla/workers/2017/msg00568.html

--
Sebastian Gniazdowski
psprint /at/ zdharma.org

Attachment: gdbm_uplift.diff
Description: Binary data



Messages sorted by: Reverse Date, Date, Thread, Author