Skip to content

Commit

Permalink
use larger buffer for overall error message (smaller one for message …
Browse files Browse the repository at this point in the history
…text from OS/libbal)
  • Loading branch information
aremmell committed Jan 7, 2024
1 parent 3cf12fe commit 7856dd1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion include/bal/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ typedef unsigned bal_threadret;
# include <inttypes.h>
# include <assert.h>

# define BAL_MAXERROR 256
# define BAL_MAXERROR 256
# define BAL_MAXERRORFMT 384
# define BAL_UNKNOWN "<unknown>"

# define BAL_AS_IPV6 "IPv6"
Expand Down
2 changes: 1 addition & 1 deletion include/bal/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ typedef struct {
/** The public error type. */
typedef struct {
int code;
char message[BAL_MAXERROR];
char message[BAL_MAXERRORFMT];
} bal_error;

/** The internal error type. */
Expand Down
4 changes: 2 additions & 2 deletions src/balerrors.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ int _bal_get_error(bal_error* err, bool extended)
}

if (extended) {
_bal_snprintf_trunc(err->message, BAL_MAXERROR, BAL_ERRFMTEXT,
_bal_snprintf_trunc(err->message, BAL_MAXERRORFMT, BAL_ERRFMTEXT,
_bal_tei.loc.func, _bal_tei.loc.file, _bal_tei.loc.line,
_bal_okptrnf(heap_msg) ? heap_msg : bal_errors[n].msg);
} else {
_bal_snprintf_trunc(err->message, BAL_MAXERROR, BAL_ERRFMT,
_bal_snprintf_trunc(err->message, BAL_MAXERRORFMT, BAL_ERRFMT,
_bal_okptrnf(heap_msg) ? heap_msg : bal_errors[n].msg);
}

Expand Down

0 comments on commit 7856dd1

Please sign in to comment.