Change to blog euid storage; note new definition in libcitadel.h
[citadel.git] / citadel / modules / blog / serv_blog.c
index 5459898f759095115fb06af6877b9d322d2efbb9..fb95d613b4a1fc2a2df963a686a31f15d6bb15d0 100644 (file)
@@ -74,11 +74,18 @@ int blog_upload_beforesave(struct CtdlMessage *msg) {
         */
        if (msg->cm_fields['E'] == NULL)
        {
-               char uuid[37];
+               char uuid[BLOG_EUIDBUF_SIZE];
                generate_uuid(uuid);
                msg->cm_fields['E'] = strdup(uuid);
        }
 
+       /*
+        * We also want to define a maximum length, whether we generated it or not.
+        */
+       else if (strlen(msg->cm_fields['E']) >= BLOG_EUIDBUF_SIZE) {
+               msg->cm_fields['E'][BLOG_EUIDBUF_SIZE-1] = 0;
+       }
+
        /* Now allow the save to complete. */
        return(0);
 }