Commit 53336f6b authored by Tommy Olofsson's avatar Tommy Olofsson
Browse files

Enabled stdio for VxWorks and fixed a potential bug where null was used as a...

Enabled stdio for VxWorks and fixed a potential bug where null was used as a buffer in the event of a failed memory allocation.
parent f9a94c57
...@@ -10,7 +10,7 @@ ifeq ($(UNAME_S),Linux) ...@@ -10,7 +10,7 @@ ifeq ($(UNAME_S),Linux)
CC=i586-wrs-vxworks-gcc CC=i586-wrs-vxworks-gcc
LD=i586-wrs-vxworks-ld LD=i586-wrs-vxworks-ld
ALL_DEPS:=$(filter-out %.so.1, $(ALL_DEPS)) ALL_DEPS:=$(filter-out %.so.1, $(ALL_DEPS))
CFLAGS:=$(CFLAGS) -DLABCOMM_COMPAT=\"labcomm_compat_vxworks.h\" -DLABCOMM_NO_STDIO CFLAGS:=$(CFLAGS) -DLABCOMM_COMPAT=\"labcomm_compat_vxworks.h\"
else else
@echo 'Invalid target.' @echo 'Invalid target.'
endif endif
......
...@@ -270,6 +270,11 @@ static inline char *labcomm_read_string(struct labcomm_reader *r) ...@@ -270,6 +270,11 @@ static inline char *labcomm_read_string(struct labcomm_reader *r)
length = labcomm_read_packed32(r); length = labcomm_read_packed32(r);
result = labcomm_memory_alloc(r->memory, 1, length + 1); result = labcomm_memory_alloc(r->memory, 1, length + 1);
if (!result) {
on_error_fprintf(LABCOMM_ERROR_MEMORY, 4, "%d byte at %s:%d",
length+1, __FUNCTION__, __LINE__);
return NULL;
}
for (pos = 0 ; pos < length ; pos++) { for (pos = 0 ; pos < length ; pos++) {
if (r->pos >= r->count) { if (r->pos >= r->count) {
labcomm_reader_fill(r, r->action_context); labcomm_reader_fill(r, r->action_context);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment