[syslinux:master] hdt: Removing corruption on printf
syslinux-bot for Erwan Velu
erwanaliasr1 at gmail.com
Mon Apr 25 15:28:40 PDT 2011
Commit-ID: 9ca3c9cc9eeb578b60c4d27746dc4e7447face0c
Gitweb: http://syslinux.zytor.com/commit/9ca3c9cc9eeb578b60c4d27746dc4e7447face0c
Author: Erwan Velu <erwanaliasr1 at gmail.com>
AuthorDate: Sun, 3 Apr 2011 20:57:51 +0200
Committer: Erwan Velu <erwanaliasr1 at gmail.com>
CommitDate: Sun, 3 Apr 2011 20:57:51 +0200
hdt: Removing corruption on printf
Prior to this commit some garbage occured. The printing buffer wasn't
correctly cleaned after usage.
---
com32/hdt/hdt-dump.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/com32/hdt/hdt-dump.c b/com32/hdt/hdt-dump.c
index 9b0fe7b..c09568c 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";
More information about the Syslinux-commits
mailing list