aboutsummaryrefslogtreecommitdiffstats
path: root/com32/hdt
diff options
context:
space:
mode:
authorErwan Velu <erwanaliasr1@gmail.com>2011-04-03 20:57:51 +0200
committerErwan Velu <erwanaliasr1@gmail.com>2011-04-03 20:57:51 +0200
commit9ca3c9cc9eeb578b60c4d27746dc4e7447face0c (patch)
treeb33bd086e41dbb2a99fddfcd9353aabfc2038474 /com32/hdt
parent4de1fbb77e587c2d6ebca54cbe6d8bf9020c8480 (diff)
downloadsyslinux-9ca3c9cc9eeb578b60c4d27746dc4e7447face0c.tar.gz
syslinux-9ca3c9cc9eeb578b60c4d27746dc4e7447face0c.tar.xz
syslinux-9ca3c9cc9eeb578b60c4d27746dc4e7447face0c.zip
hdt: Removing corruption on printf
Prior to this commit some garbage occured. The printing buffer wasn't correctly cleaned after usage.
Diffstat (limited to 'com32/hdt')
-rw-r--r--com32/hdt/hdt-dump.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/com32/hdt/hdt-dump.c b/com32/hdt/hdt-dump.c
index 9b0fe7bc..c09568c8 100644
--- a/com32/hdt/hdt-dump.c
+++ b/com32/hdt/hdt-dump.c
@@ -70,16 +70,21 @@ int dumpprintf(FILE *p, const char *format, ...) {
return rv;
}
-void flush (char *filename, ZZJSON_CONFIG *config, ZZJSON ** item) {
- zzjson_print(config, *item);
+void to_cpio(char *filename) {
cpio_writefile(upload,filename,p_buf.buf,p_buf.len);
- if ((p_buf.buf) && (p_buf.size > 0)){
- memset(p_buf.buf,0,p_buf.size);
+ if ((p_buf.buf) && (p_buf.len > 0)){
+ memset(p_buf.buf,0,p_buf.len);
free(p_buf.buf);
+ p_buf.buf=NULL;
p_buf.size=0;
p_buf.len=0;
}
+}
+
+void flush (ZZJSON_CONFIG *config, ZZJSON ** item) {
+ zzjson_print(config, *item);
zzjson_free(config, *item);
+ *item=NULL;
}
/**
@@ -97,6 +102,8 @@ void dump(struct s_hardware *hardware)
(int(*)(int,void*)) fputc
};
+ memset(&p_buf,0,sizeof(p_buf));
+
/* By now, we only support TFTP reporting */
upload=&upload_tftp;
upload->name="tftp";