[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r29264 - gnunet/src/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r29264 - gnunet/src/fs |
Date: |
Sun, 15 Sep 2013 18:57:49 +0200 |
Author: grothoff
Date: 2013-09-15 18:57:49 +0200 (Sun, 15 Sep 2013)
New Revision: 29264
Modified:
gnunet/src/fs/gnunet-helper-fs-publish.c
Log:
auto-correct missing 0-terminators in C_STRINGS/UTF-8 strings
Modified: gnunet/src/fs/gnunet-helper-fs-publish.c
===================================================================
--- gnunet/src/fs/gnunet-helper-fs-publish.c 2013-09-15 16:01:27 UTC (rev
29263)
+++ gnunet/src/fs/gnunet-helper-fs-publish.c 2013-09-15 16:57:49 UTC (rev
29264)
@@ -75,7 +75,7 @@
uint64_t file_size;
/**
- * GNUNET_YES if this is a directory
+ * #GNUNET_YES if this is a directory
*/
int is_directory;
@@ -107,7 +107,7 @@
* @param data_mime_type mime-type of data (not of the original file);
* can be NULL (if mime-type is not known)
* @param data actual meta-data found
- * @param data_len number of bytes in data
+ * @param data_len number of bytes in @a data
* @return always 0 to continue extracting
*/
static int
@@ -117,14 +117,27 @@
{
struct GNUNET_CONTAINER_MetaData *md = cls;
- (void) GNUNET_CONTAINER_meta_data_insert (md, plugin_name, type, format,
- data_mime_type, data, data_len);
+ if ( ((EXTRACTOR_METAFORMAT_UTF8 == format) ||
+ (EXTRACTOR_METAFORMAT_C_STRING == format)) &&
+ ('\0' != data[data_size - 1]) )
+ {
+ char zdata[data_len + 1];
+ memcpy (zdata, data, data_len);
+ zdata[data_size] = '\0';
+ (void) GNUNET_CONTAINER_meta_data_insert (md, plugin_name, type, format,
+ data_mime_type, zdata, data_len +
1);
+ }
+ else
+ {
+ (void) GNUNET_CONTAINER_meta_data_insert (md, plugin_name, type, format,
+ data_mime_type, data, data_len);
+ }
return 0;
}
/**
- * Free memory of the 'tree' structure
+ * Free memory of the @a tree structure
*
* @param tree tree to free
*/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r29264 - gnunet/src/fs,
gnunet <=