RTEMS | dosfs: Avoid NULL pointer dereference UB (!1348)

Vijay Banerjee (@vijay) gitlab at rtems.org
Wed Jul 22 00:34:45 UTC 2026



Merge request https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1348 was reviewed by Vijay Banerjee

--
  
Vijay Banerjee started a new discussion on cpukit/libfs/src/dosfs/msdos_conv_default.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1348#note_154985

 >      super->buffer.size = sizeof( self->buffer );

We can add `return &self->super` here inside the if block.

--
  
Vijay Banerjee started a new discussion on cpukit/libfs/src/dosfs/msdos_conv_default.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1348#note_154986

 >  
 > -  return &self->super;
 > +  return self != NULL ? &self->super : NULL;

... and add return `NULL` here. This way we avoid a duplicate check of `self != NULL`

--
  
Vijay Banerjee started a new discussion on cpukit/libfs/src/dosfs/msdos_conv_utf8.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1348#note_154987

 >  
 > -  return &self->super;
 > +  return self != NULL ? &self->super : NULL;

Same as above comment(s)


-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1348
You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/sent_notifications/4-7axcf32t5kr6q9zfcm5jmxrzf-1d/unsubscribe | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | Help: https://gitlab.rtems.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260722/5347f7e8/attachment-0001.htm>


More information about the bugs mailing list