diff --git a/lib/c/Makefile b/lib/c/Makefile index fcb53ba2fb3417888013c8e0b31bb5d1aacc975f..c5af86b5d5b8e42d646bc3305de47ca9da3e558a 100644 --- a/lib/c/Makefile +++ b/lib/c/Makefile @@ -10,7 +10,7 @@ ifeq ($(UNAME_S),Linux) CC=i586-wrs-vxworks-gcc LD=i586-wrs-vxworks-ld 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 @echo 'Invalid target.' endif diff --git a/lib/c/labcomm_private.h b/lib/c/labcomm_private.h index c74c4a7b7d9a02bfe1e0c4dea169212cfebeecf3..e615799bb1b92225d4f6604aa36e8a33953fa06c 100644 --- a/lib/c/labcomm_private.h +++ b/lib/c/labcomm_private.h @@ -270,6 +270,11 @@ static inline char *labcomm_read_string(struct labcomm_reader *r) length = labcomm_read_packed32(r); 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++) { if (r->pos >= r->count) { labcomm_reader_fill(r, r->action_context);