Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147971131
D13184.id36324.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
799 B
Referenced Files
None
Subscribers
None
D13184.id36324.diff
View Options
Index: head/lib/libcam/camlib.c
===================================================================
--- head/lib/libcam/camlib.c
+++ head/lib/libcam/camlib.c
@@ -30,6 +30,7 @@
#include <sys/types.h>
#include <sys/param.h>
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
@@ -132,6 +133,9 @@
* it so we don't hose the user's string.
*/
newpath = (char *)strdup(path);
+ if (newpath == NULL)
+ return (-1);
+
tmpstr = newpath;
/*
@@ -140,8 +144,9 @@
if (*tmpstr == '/') {
tmpstr2 = tmpstr;
tmpstr = strrchr(tmpstr2, '/');
- if ((tmpstr != NULL) && (*tmpstr != '\0'))
- tmpstr++;
+ /* We know that tmpstr2 contains a '/', so strrchr can't fail */
+ assert(tmpstr != NULL && *tmpstr != '\0');
+ tmpstr++;
}
if (*tmpstr == '\0') {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 15, 11:02 PM (17 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29739947
Default Alt Text
D13184.id36324.diff (799 B)
Attached To
Mode
D13184: Fix a null-pointer dereference and a tautological check in cam_get_device
Attached
Detach File
Event Timeline
Log In to Comment