summaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/ChangeLog4
-rw-r--r--nuttx/sched/sig_timedwait.c14
2 files changed, 13 insertions, 5 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index de0f8872f..523d11ddd 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -2224,4 +2224,6 @@
board.
* include/sys/types.h: wchar_t is a builtin type in C++ and its
declaration can cause errors with certain C++ compilers.
-
+ * sched/sig_timedwait.c: Fix signal handling with the returned info
+ is NULL. Before this change, it would derefence a NULL pointer
+ in this case.
diff --git a/nuttx/sched/sig_timedwait.c b/nuttx/sched/sig_timedwait.c
index dbbf444dc..2d9afaab1 100644
--- a/nuttx/sched/sig_timedwait.c
+++ b/nuttx/sched/sig_timedwait.c
@@ -277,12 +277,18 @@ int sigtimedwait(FAR const sigset_t *set, FAR struct siginfo *info,
if (info)
{
memcpy(info, &rtcb->sigunbinfo, sizeof(struct siginfo));
- }
- irqrestore(saved_state);
- /* The return value is the number of the signal that awakened us */
+ /* The return value is the number of the signal that awakened us */
- ret = info->si_signo;
+ ret = info->si_signo;
+ }
+ else
+ {
+ /* We don't know which signal awakened us. This is probably a bug. */
+
+ ret = 0;
+ }
+ irqrestore(saved_state);
}
sched_unlock();